Millisecond Forums

expression to test >20% radiobuttons unanswered

https://forums.millisecond.com/Topic36070.aspx

By nidhi_desai - 3/13/2024

I have 24 such radiobutton questions and I would like to test if more than 20% of these questions were unanswered at the end of the surveypage. How would I go about doing this?
By Dave - 3/13/2024

nidhi_desai - 3/14/2024
I have 24 such radiobutton questions and I would like to test if more than 20% of these questions were unanswered at the end of the surveypage. How would I go about doing this?

(1) Provide concrete examples of exactly what your particular radiobuttons look like.
(2) You want to test if some perccentage wasn't answered. And then what?
By nidhi_desai - 3/13/2024

Dave - 3/14/2024
nidhi_desai - 3/14/2024
I have 24 such radiobutton questions and I would like to test if more than 20% of these questions were unanswered at the end of the surveypage. How would I go about doing this?

(1) Provide concrete examples of exactly what your particular radiobuttons look like.
(2) You want to test if some perccentage wasn't answered. And then what?

My radiobuttons look like:
<radiobuttons pai_bor_q3>
/ caption = "<% list.pai_bor_questions.item(3) %>"
/ options = (
  "False,~nnot at all true",
  "Slightly true",
  "Mainly true",
  "Very true")
/ required = false
/ orientation = horizontalequal
</radiobuttons>
and the surveypage:

<surveypage pai_bor_surveypage2>
/ caption = "~nThis questionnaire consists of numbered statements. Read each statement and decide if it is an accurate statement about you. Give your own opinion of yourself. Be sure to answer every statement.~n~n"
/ questions = [
1 = pai_bor_q11;
2 = pai_bor_q12;
3 = pai_bor_q13;
4 = infreq_q2;....]
/ ontrialbegin = [
   values.t_start = script.elapsedtime;
]
/ ontrialend = [
    values.t_end = script.elapsedtime;
    if (radiobuttons.infreq_q2.response != list.infrequency_ans.item(2)){
        values.infreq_num_failed = values.infreq_num_failed + 1;
    }
    if (radiobuttons.infreq_q3.response != list.infrequency_ans.item(3) &&
            radiobuttons.infreq_q3.response != list.infrequency_ans.item(4)){
        values.infreq_num_failed = values.infreq_num_failed + 1;
    } if (radiobuttons.infreq_q4.response != list.infrequency_ans.item(5)){
        values.infreq_num_failed = values.infreq_num_failed + 1;
    }
]
/ branch = [
    if(values.infreq_num_failed > 1){
        return surveypage.redirect_prolific_fail;
    } else {
        return surveypage.end_of_survey;
    }
]
</surveypage>

In the branch statement, I would like to add a condition if number of radiobuttons unanswered is greater than 20% then branch to a different page called surveypage.redirect_new.
By Dave - 3/13/2024

nidhi_desai - 3/14/2024
Dave - 3/14/2024
nidhi_desai - 3/14/2024
I have 24 such radiobutton questions and I would like to test if more than 20% of these questions were unanswered at the end of the surveypage. How would I go about doing this?

(1) Provide concrete examples of exactly what your particular radiobuttons look like.
(2) You want to test if some perccentage wasn't answered. And then what?

My radiobuttons look like:
<radiobuttons pai_bor_q3>
/ caption = "<% list.pai_bor_questions.item(3) %>"
/ options = (
  "False,~nnot at all true",
  "Slightly true",
  "Mainly true",
  "Very true")
/ required = false
/ orientation = horizontalequal
</radiobuttons>
and the surveypage:

<surveypage pai_bor_surveypage2>
/ caption = "~nThis questionnaire consists of numbered statements. Read each statement and decide if it is an accurate statement about you. Give your own opinion of yourself. Be sure to answer every statement.~n~n"
/ questions = [
1 = pai_bor_q11;
2 = pai_bor_q12;
3 = pai_bor_q13;
4 = infreq_q2;....]
/ ontrialbegin = [
   values.t_start = script.elapsedtime;
]
/ ontrialend = [
    values.t_end = script.elapsedtime;
    if (radiobuttons.infreq_q2.response != list.infrequency_ans.item(2)){
        values.infreq_num_failed = values.infreq_num_failed + 1;
    }
    if (radiobuttons.infreq_q3.response != list.infrequency_ans.item(3) &&
            radiobuttons.infreq_q3.response != list.infrequency_ans.item(4)){
        values.infreq_num_failed = values.infreq_num_failed + 1;
    } if (radiobuttons.infreq_q4.response != list.infrequency_ans.item(5)){
        values.infreq_num_failed = values.infreq_num_failed + 1;
    }
]
/ branch = [
    if(values.infreq_num_failed > 1){
        return surveypage.redirect_prolific_fail;
    } else {
        return surveypage.end_of_survey;
    }
]
</surveypage>

In the branch statement, I would like to add a condition if number of radiobuttons unanswered is greater than 20% then branch to a different page called surveypage.redirect_new.

Check each radiobuttons response property /ontrialend. If it is the empty string, increase a variable by one, i.e. count the unanswered ones. If the variable exceeds the threshold (i.e. > 4 if you have 24 radiobuttons), /branch to the other page.

<values>
/ unanswered = 0
</values>

<radiobuttons q1>
/ caption = "Q1"
/ options = (
"False,~nnot at all true",
"Slightly true",
"Mainly true",
"Very true")
/ required = false
/ orientation = horizontalequal
</radiobuttons>

<radiobuttons q2>
/ caption = "Q2"
/ options = (
"False,~nnot at all true",
"Slightly true",
"Mainly true",
"Very true")
/ required = false
/ orientation = horizontalequal
</radiobuttons>

<radiobuttons q3>
/ caption = "Q3"
/ options = (
"False,~nnot at all true",
"Slightly true",
"Mainly true",
"Very true")
/ required = false
/ orientation = horizontalequal
</radiobuttons>

<surveypage mypage>
/ ontrialend = [
    if (radiobuttons.q1.response == ""){
        values.unanswered += 1;
    };
    if (radiobuttons.q2.response == ""){
        values.unanswered += 1;
    };
    if (radiobuttons.q3.response == ""){
        values.unanswered += 1;
    };
]
/ questions = [1=q1; 2=q2; 3=q3]
/ branch = [
    if (values.unanswered > 1) {
        return surveypage.toomanyunanswered;
    }
]
/ showpagenumbers = false
</surveypage>

<surveypage toomanyunanswered>
/ caption = "You left <%values.unanswered%> questions unanswered."
/ showpagenumbers = false
</surveypage>

<block myblock>
/ trials = [1=mypage]
</block>