{"SurveyEntry":{"SurveyID":"SV_8vr7RhqCus0Ekui","SurveyName":"RRT","SurveyDescription":null,"SurveyOwnerID":"UR_6FpKlW9iWshPJ5i","SurveyBrandID":"berkeley","DivisionID":"DV_cSlN2nf6kOkdIkB","SurveyLanguage":"EN","SurveyActiveResponseSet":"RS_9NbLaaJKb6D5o7c","SurveyStatus":"Active","SurveyStartDate":"0000-00-00 00:00:00","SurveyExpirationDate":"0000-00-00 00:00:00","SurveyCreationDate":"2024-09-27 11:40:13","CreatorID":"UR_6FpKlW9iWshPJ5i","LastModified":"2024-10-30 21:19:04","LastAccessed":"0000-00-00 00:00:00","LastActivated":"2024-09-27 11:45:12","Deleted":null},"SurveyElements":[{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"BL","PrimaryAttribute":"Survey Blocks","SecondaryAttribute":null,"TertiaryAttribute":null,"Payload":{"0":{"Type":"Default","Description":"Consent form","ID":"BL_8jppQQ5Hn6rr6Ae","BlockElements":[{"Type":"Question","QuestionID":"QID1"},{"Type":"Question","QuestionID":"QID43"},{"Type":"Question","QuestionID":"QID48"}],"Options":{"BlockLocking":"false","RandomizeQuestions":"false","BlockVisibility":"Expanded"}},"1":{"Type":"Trash","Description":"Trash \/ Unused Questions","ID":"BL_1NA7r21aKkL0YhU","BlockElements":[{"Type":"Question","QuestionID":"QID188"},{"Type":"Question","QuestionID":"QID167"},{"Type":"Question","QuestionID":"QID152"},{"Type":"Question","QuestionID":"QID185"},{"Type":"Question","QuestionID":"QID186"},{"Type":"Question","QuestionID":"QID187"},{"Type":"Question","QuestionID":"QID178"},{"Type":"Question","QuestionID":"QID161"},{"Type":"Question","QuestionID":"QID190"},{"Type":"Question","QuestionID":"QID189"},{"Type":"Question","QuestionID":"QID196"},{"Type":"Question","QuestionID":"QID202"},{"Type":"Question","QuestionID":"QID38"},{"Type":"Question","QuestionID":"QID176"},{"Type":"Question","QuestionID":"QID206"}],"Options":{"BlockLocking":"false","RandomizeQuestions":"false","BlockVisibility":"Collapsed"}},"2":{"Type":"Standard","SubType":"","Description":"Instructions and comprehension check","ID":"BL_6u2ad4WuOCaM1hQ","BlockElements":[{"Type":"Question","QuestionID":"QID172"},{"Type":"Page Break"},{"Type":"Question","QuestionID":"QID2"},{"Type":"Page Break"},{"Type":"Question","QuestionID":"QID191"},{"Type":"Page Break"},{"Type":"Question","QuestionID":"QID192"},{"Type":"Page Break"},{"Type":"Question","QuestionID":"QID193"},{"Type":"Page Break"},{"Type":"Question","QuestionID":"QID203"},{"Type":"Page Break"},{"Type":"Question","QuestionID":"QID194"},{"Type":"Page Break"},{"Type":"Question","QuestionID":"QID173"},{"Type":"Question","QuestionID":"QID199"},{"Type":"Question","QuestionID":"QID198"},{"Type":"Question","QuestionID":"QID174"},{"Type":"Question","QuestionID":"QID204"},{"Type":"Question","QuestionID":"QID175"},{"Type":"Question","QuestionID":"QID205"}],"Options":{"BlockLocking":"false","RandomizeQuestions":"false","BlockVisibility":"Expanded"}},"6":{"Type":"Standard","SubType":"","Description":"Comments","ID":"BL_dmSH9uochXe8ma2","BlockElements":[{"Type":"Question","QuestionID":"QID200"},{"Type":"Question","QuestionID":"QID83"},{"Type":"Question","QuestionID":"QID39"},{"Type":"Question","QuestionID":"QID52"},{"Type":"Question","QuestionID":"QID201"}],"Options":{"BlockLocking":"false","RandomizeQuestions":"false","BlockVisibility":"Expanded"}},"10":{"Type":"Standard","SubType":"","Description":"Main Experiment","ID":"BL_29Lvpc9eCt7gER0","BlockElements":[{"Type":"Question","QuestionID":"QID195"}],"Options":{"BlockLocking":"false","RandomizeQuestions":"false","BlockVisibility":"Expanded","Looping":"Static","LoopingOptions":{"Static":{"1":{"1":"1"},"2":{"1":"2"},"3":{"1":"3"},"4":{"1":"4"},"5":{"1":"5"},"6":{"1":"6"},"7":{"1":"7"},"8":{"1":"8"},"9":{"1":"9"},"10":{"1":"10"},"11":{"1":"11"},"12":{"1":"12"},"13":{"1":"13"},"14":{"1":"14"},"15":{"1":"15"}},"Randomization":"None"}}},"11":{"Type":"Standard","SubType":"","Description":"Get ready for main loop","ID":"BL_71DdoHDKrWP2Qse","BlockElements":[{"Type":"Question","QuestionID":"QID197"}],"Options":{"BlockLocking":"false","RandomizeQuestions":"false","BlockVisibility":"Expanded"}}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"FL","PrimaryAttribute":"Survey Flow","SecondaryAttribute":null,"TertiaryAttribute":null,"Payload":{"Type":"Root","FlowID":"FL_1","Flow":[{"Type":"EmbeddedData","FlowID":"FL_48","EmbeddedData":[{"Description":"allSliderData","Type":"Recipient","Field":"allSliderData","VariableType":"String","DataVisibility":[],"AnalyzeText":false},{"Description":"randOrder","Type":"Recipient","Field":"randOrder","VariableType":"String","DataVisibility":[],"AnalyzeText":false},{"Description":"conditionNum","Type":"Recipient","Field":"conditionNum","VariableType":"String","DataVisibility":[],"AnalyzeText":false},{"Description":"Create New Field or Choose From Dropdown...","Type":"Recipient","Field":"Create New Field or Choose From Dropdown...","VariableType":"String","DataVisibility":[],"AnalyzeText":false},{"Description":"loopCounter","Type":"Custom","Field":"loopCounter","VariableType":"String","DataVisibility":[],"AnalyzeText":false,"Value":"-2"},{"Description":"Create New Field or Choose From Dropdown...","Type":"Recipient","Field":"Create New Field or Choose From Dropdown...","VariableType":"String","DataVisibility":[],"AnalyzeText":false},{"Description":"Create New Field or Choose From Dropdown...","Type":"Recipient","Field":"Create New Field or Choose From Dropdown...","VariableType":"String","DataVisibility":[],"AnalyzeText":false},{"Description":"Create New Field or Choose From Dropdown...","Type":"Recipient","Field":"Create New Field or Choose From Dropdown...","VariableType":"String","DataVisibility":[],"AnalyzeText":false},{"Description":"Create New Field or Choose From Dropdown...","Type":"Recipient","Field":"Create New Field or Choose From Dropdown...","VariableType":"String","DataVisibility":[],"AnalyzeText":false},{"Description":"Create New Field or Choose From Dropdown...","Type":"Recipient","Field":"Create New Field or Choose From Dropdown...","VariableType":"String","DataVisibility":[],"AnalyzeText":false}]},{"Type":"BlockRandomizer","FlowID":"FL_40","SubSet":1,"EvenPresentation":true,"Flow":[{"Type":"EmbeddedData","FlowID":"FL_41","EmbeddedData":[{"Description":"Condition","Type":"Custom","Field":"Condition","VariableType":"String","DataVisibility":[],"AnalyzeText":false,"Value":"cl"}]},{"Type":"EmbeddedData","FlowID":"FL_42","EmbeddedData":[{"Description":"Condition","Type":"Custom","Field":"Condition","VariableType":"String","DataVisibility":[],"AnalyzeText":false,"Value":"cn"}]},{"Type":"EmbeddedData","FlowID":"FL_43","EmbeddedData":[{"Description":"Condition","Type":"Custom","Field":"Condition","VariableType":"String","DataVisibility":[],"AnalyzeText":false,"Value":"fl"}]},{"Type":"EmbeddedData","FlowID":"FL_44","EmbeddedData":[{"Description":"Condition","Type":"Custom","Field":"Condition","VariableType":"String","DataVisibility":[],"AnalyzeText":false,"Value":"fn"}]}]},{"Type":"Block","ID":"BL_8jppQQ5Hn6rr6Ae","FlowID":"FL_2","Autofill":[]},{"Type":"Standard","ID":"BL_6u2ad4WuOCaM1hQ","FlowID":"FL_3","Autofill":[]},{"Type":"Standard","ID":"BL_71DdoHDKrWP2Qse","FlowID":"FL_51","Autofill":[]},{"Type":"Standard","ID":"BL_29Lvpc9eCt7gER0","FlowID":"FL_47","Autofill":[]},{"Type":"Standard","ID":"BL_dmSH9uochXe8ma2","FlowID":"FL_9","Autofill":[]}],"Properties":{"Count":51}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"PL","PrimaryAttribute":"Preview Link","SecondaryAttribute":null,"TertiaryAttribute":null,"Payload":{"PreviewType":"Brand","PreviewID":"a464b0c9-675f-4306-b079-849bdd3a2a42"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"RS","PrimaryAttribute":"RS_9NbLaaJKb6D5o7c","SecondaryAttribute":null,"TertiaryAttribute":null,"Payload":null},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SO","PrimaryAttribute":"Survey Options","SecondaryAttribute":null,"TertiaryAttribute":null,"Payload":{"BackButton":"false","SaveAndContinue":"false","SurveyProtection":"PublicSurvey","BallotBoxStuffingPrevention":"true","NoIndex":"Yes","SecureResponseFiles":"true","SurveyExpiration":"None","SurveyTermination":"Redirect","Header":"","Footer":"","ProgressBarDisplay":"None","PartialData":"+1 hour","ValidationMessage":null,"PreviousButton":" \u2190 ","NextButton":" \u2192 ","SurveyTitle":"Prediction Survey","SkinLibrary":"berkeley","SkinType":"MQ","Skin":"berkeleyss2","NewScoring":1,"SurveyMetaDescription":"Predict sales.  ","EOSMessage":"MS_3CbTAG4XApiyfj0","ShowExportTags":"false","CollectGeoLocation":"false","PasswordProtection":"No","AnonymizeResponse":"Yes","RefererCheck":"No","BallotBoxStuffingPreventionBehavior":"DefaultMessage","BallotBoxStuffingPreventionMessage":null,"BallotBoxStuffingPreventionMessageLibrary":null,"BallotBoxStuffingPreventionURL":null,"RecaptchaV3":"true","ConfirmStart":false,"AutoConfirmStart":false,"RelevantID":"false","RelevantIDLockoutPeriod":"+30 days","UseCustomSurveyLinkCompletedMessage":null,"SurveyLinkCompletedMessage":null,"SurveyLinkCompletedMessageLibrary":null,"ResponseSummary":"No","EOSMessageLibrary":"UR_6FpKlW9iWshPJ5i","EOSRedirectURL":"https:\/\/app.prolific.co\/submissions\/complete?cc=CBBWGCXI","EmailThankYou":"false","ThankYouEmailMessageLibrary":null,"ThankYouEmailMessage":null,"ValidateMessage":"false","ValidationMessageLibrary":null,"InactiveSurvey":"DefaultMessage","PartialDeletion":null,"PartialDataCloseAfter":"LastActivity","InactiveMessageLibrary":null,"InactiveMessage":null,"AvailableLanguages":{"EN":[]},"ProtectSelectionIds":true,"CustomStyles":{"customCSS":"table td:nth-child(2) { \/* Column for percentages *\/\n    width: 50px;\n    text-align: left;\n}\n\n.exact-answer {\n    position: absolute;\n    top: 53%;\n    left: 50%;\n    transform: translate(-50%, -50%); \/* This centers the element *\/\n    font-weight: bold; \/* Makes the X a bit bolder *\/\n    font-size: 40px; \/* Adjust the size as desired *\/\n    color: #800000; \/* Sets the color of the X to red *\/\n    z-index: 1; \/* to ensure it's above *\/\n}\n\n.red-area {\n    position: absolute;\n    height: 1px; \/* same as slider track height *\/\n    background-color: orange;\n    top: 53%;\n    transform: translateY(-50%); \/* to vertically center it *\/\n    display: none; \/* initially hidden *\/\n    z-index: 2; \/* to ensure it's above the slider, but you may need to adjust if there are other overlapping elements *\/\n}\n\n.red-area::before, .red-area::after {\n    content: \"|\";\n    position: absolute;\n    top: 50%;\n    transform: translateY(-50%);\n    font-weight: bold;\n    color: orange;\n}\n\n.red-area::before {\n    left: -2px;\n}\n\n.red-area::after {\n    right: -2px;\n}\n\n\ninput[type=range] {\n    -webkit-appearance: none;\n    width: 100%;\n    background: transparent;\n    outline: none;\n}\n\ninput[type=range]::-webkit-slider-thumb {\n     visibility: hidden;\n    -webkit-appearance: none;\n    appearance: none;\n    margin-top: -6px; \/* Adjust this to center the dot on the slider bar *\/\n    width: 20px;\n    height: 20px;\n    background: linear-gradient(145deg, #3b98db, #2c8ad4);\n    cursor: pointer;\n    border-radius: 50%;\n    box-shadow:  3px 3px 5px #b5b5b5, \n                -3px -3px 5px #ffffff;\n}\n\ninput[type=range]::-moz-range-thumb {\n    visibility: hidden;\n    margin-top: -6px;\n    width: 20px;\n    height: 20px;\n    background: linear-gradient(145deg, #3b98db, #2c8ad4);\n    cursor: pointer;\n    border-radius: 50%;\n    box-shadow:  3px 3px 5px #b5b5b5, \n                -3px -3px 5px #ffffff;\n}\n\ninput[type=range].show-thumb::-webkit-slider-thumb {\n    visibility: visible; \/* Make the thumb visible for WebKit browsers *\/\n}\n\ninput[type=range].show-thumb::-moz-range-thumb {\n    visibility: visible; \/* Make the thumb visible for Mozilla browsers *\/\n}\n\ninput[type=range]::-webkit-slider-runnable-track {\n    width: 100%;\n    height: 8px;\n    cursor: pointer;\n    background: #E0E0E0;\n    border-radius: 4px;\n    box-shadow:  inset 2px 2px 5px #b5b5b5, \n                inset -3px -3px 5px #ffffff;\n}\n\ninput[type=range]::-moz-range-track {\n    width: 100%;\n    height: 8px;\n    cursor: pointer;\n    background: #E0E0E0;\n    border-radius: 4px;\n    box-shadow:  inset 2px 2px 5px #b5b5b5, \n                inset -3px -3px 5px #ffffff;\n}\n\ninput[type=range]::-moz-focus-outer {\n    border: 0;\n}\n\n.slider-container {\n    position: relative;\n}\n\n.slider-instruction {\n    position: absolute;\n    top: 50%; \/* Adjust as needed *\/\n    left: 50%; \/* Adjust as needed *\/\n    transform: translate(-50%, -50%);\n    pointer-events: none; \/* Allows clicks to pass through to the slider *\/\n    color: grey; \/* Grey color for the text *\/\n    white-space: nowrap; \/* Prevents the text from wrapping *\/\n    width: auto; \/* Adjust the width as needed *\/\n    max-width: 100%; \/* Ensures it doesn't exceed the slider container *\/\n    text-align: center; \/* Center the text *\/\n}\n\n\n#slidersContainer {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 20px;  \/* Spacing between the sliders *\/\n    margin-top: 20px; \/* Spacing above the sliders. Adjust as needed. *\/\n}\n\n#slidersContainer > div {\n    width: 30%;  \/* Added this line to give each slider container 50% width *\/\n    position: relative;\n}\n\n.slider-wrapper {\n    position: relative;\n}\n\n      .container {\n            display: flex;\n            align-items: flex-start;\n        }\n\n        img {\n            max-width: 100%;\n        }\n\n        table {\n            margin-left: 10px;\n            padding: 0;\n        }\n\n        td {\n            width: 20px;\n            text-align: center;\n            padding: 0;\n        }\n        \/* Styling for the bars *\/\n        .bar-container {\n            width: 50px;  \/* Set a max width for the bars *\/\n            border: 1px solid #aaa;\n            padding:0px;\n        }\n\n        .bar {\n            background-color: #3498db;\n            height: 20px;\n        }\n\n#dot {\n    position: absolute;\n    background-color: gray;  \/* Add this to make it a gray dot *\/\n    width: 15px;   \/* Define the size of the dot *\/\n    height: 15px;\n    border-radius: 50%;   \/* Make the dot circular *\/\n    color: transparent;  \/* Hide the \"x\" text color *\/\n    text-align: center;\n    line-height: 20px; \/* Vertically center the \"x\", in case you switch back *\/\n}\n\n#imageContainer {\n    position: relative;\n    display: inline-flex;   \/* use flex to ensure it covers both the image and dot *\/\n    align-items: flex-start; \/* align content to the top *\/\n}\n\n.hidden {\n    display: none !important;\n}\n"}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SCO","PrimaryAttribute":"Scoring","SecondaryAttribute":null,"TertiaryAttribute":null,"Payload":{"ScoringCategories":[],"ScoringCategoryGroups":[],"ScoringSummaryCategory":null,"ScoringSummaryAfterQuestions":0,"ScoringSummaryAfterSurvey":0,"DefaultScoringCategory":null,"AutoScoringCategory":null}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"PROJ","PrimaryAttribute":"CORE","SecondaryAttribute":null,"TertiaryAttribute":"1.1.0","Payload":{"ProjectCategory":"CORE","SchemaVersion":"1.1.0"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"STAT","PrimaryAttribute":"Survey Statistics","SecondaryAttribute":null,"TertiaryAttribute":null,"Payload":{"MobileCompatible":true,"ID":"Survey Statistics"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID43","SecondaryAttribute":" ","TertiaryAttribute":null,"Payload":{"QuestionText":"&nbsp;","DefaultChoices":false,"DataExportTag":"Q43","QuestionType":"Captcha","Selector":"V2","Configuration":{"QuestionDescriptionOption":"UseText","Align":"left","Theme":"light"},"QuestionDescription":" ","GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID43","QuestionJS":false,"DataVisibility":{"Private":false,"Hidden":false}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID188","SecondaryAttribute":" ","TertiaryAttribute":null,"Payload":{"QuestionText":"&nbsp;&nbsp;","DefaultChoices":{"TEXT":{"Text":"Store ${lm:\/\/CurrentLoopNumber} of 6:"}},"DataExportTag":"StoreNo","QuestionID":"QID188","QuestionType":"TE","Selector":"SL","Configuration":{"QuestionDescriptionOption":"UseText","InputWidth":157,"InputHeight":29},"QuestionDescription":" ","Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"SearchSource":{"AllowFreeResponse":"false"},"DataVisibility":{"Private":false,"Hidden":false}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID152","SecondaryAttribute":"${lm:\/\/Field\/6} ${lm:\/\/Field\/2}","TertiaryAttribute":null,"Payload":{"QuestionText":"${lm:\/\/Field\/6}<br>${lm:\/\/Field\/2}","DefaultChoices":false,"DataExportTag":"cl","QuestionID":"QID152","QuestionType":"DB","Selector":"TB","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"${lm:\/\/Field\/6} ${lm:\/\/Field\/2}","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"DataVisibility":{"Private":false,"Hidden":false},"DisplayLogic":{"0":{"0":{"Description":"<span class=\"ConjDesc\">If<\/span>  <span class=\"LeftOpDesc\">Condition<\/span> <span class=\"OpDesc\">Is Equal to<\/span> <span class=\"RightOpDesc\"> cl <\/span>","LeftOperand":"Condition","LogicType":"EmbeddedField","Operator":"EqualTo","RightOperand":"cl","Type":"Expression"},"Type":"If"},"Type":"BooleanExpression","inPage":false}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID185","SecondaryAttribute":"${lm:\/\/Field\/7} ${lm:\/\/Field\/3}","TertiaryAttribute":null,"Payload":{"QuestionText":"${lm:\/\/Field\/7}<br>${lm:\/\/Field\/3}","DefaultChoices":false,"DataExportTag":"cn","QuestionType":"DB","Selector":"TB","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"${lm:\/\/Field\/7} ${lm:\/\/Field\/3}","DisplayLogic":{"0":{"0":{"Description":"<span class=\"ConjDesc\">If<\/span>  <span class=\"LeftOpDesc\">Condition<\/span> <span class=\"OpDesc\">Is Equal to<\/span> <span class=\"RightOpDesc\"> cn <\/span>","LeftOperand":"Condition","LogicType":"EmbeddedField","Operator":"EqualTo","RightOperand":"cn","Type":"Expression"},"Type":"If"},"Type":"BooleanExpression","inPage":false},"ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID185"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID186","SecondaryAttribute":"${lm:\/\/Field\/8} ${lm:\/\/Field\/4}","TertiaryAttribute":null,"Payload":{"QuestionText":"${lm:\/\/Field\/8}<br>${lm:\/\/Field\/4}","DefaultChoices":false,"DataExportTag":"fl","QuestionType":"DB","Selector":"TB","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"${lm:\/\/Field\/8} ${lm:\/\/Field\/4}","DisplayLogic":{"0":{"0":{"Description":"<span class=\"ConjDesc\">If<\/span>  <span class=\"LeftOpDesc\">Condition<\/span> <span class=\"OpDesc\">Is Equal to<\/span> <span class=\"RightOpDesc\"> fl <\/span>","LeftOperand":"Condition","LogicType":"EmbeddedField","Operator":"EqualTo","RightOperand":"fl","Type":"Expression"},"Type":"If"},"Type":"BooleanExpression","inPage":false},"ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID186"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID187","SecondaryAttribute":"${lm:\/\/Field\/9} ${lm:\/\/Field\/5}","TertiaryAttribute":null,"Payload":{"QuestionText":"${lm:\/\/Field\/9}<br>${lm:\/\/Field\/5}","DefaultChoices":false,"DataExportTag":"Q105","QuestionType":"DB","Selector":"TB","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"${lm:\/\/Field\/9} ${lm:\/\/Field\/5}","DisplayLogic":{"0":{"0":{"Description":"<span class=\"ConjDesc\">If<\/span>  <span class=\"LeftOpDesc\">Condition<\/span> <span class=\"OpDesc\">Is Equal to<\/span> <span class=\"RightOpDesc\"> fn <\/span>","LeftOperand":"Condition","LogicType":"EmbeddedField","Operator":"EqualTo","RightOperand":"fn","Type":"Expression"},"Type":"If"},"Type":"BooleanExpression","inPage":false},"ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID187"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID200","SecondaryAttribute":"(Optional) If there is anything you'd like to tell us about this survey, please do:","TertiaryAttribute":null,"Payload":{"QuestionText":"(Optional) If there is anything you'd like to tell us about this survey, please do:","DefaultChoices":false,"DataExportTag":"Q33","QuestionType":"TE","Selector":"ML","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText","InputWidth":680,"InputHeight":60},"QuestionDescription":"(Optional) If there is anything you'd like to tell us about this survey, please do:","Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"SearchSource":{"AllowFreeResponse":"false"},"QuestionID":"QID200"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID83","SecondaryAttribute":"(Optional) What do you think this research project is studying?","TertiaryAttribute":null,"Payload":{"QuestionText":"(Optional) What do you think this research project is studying?","DefaultChoices":false,"DataExportTag":"Q46","QuestionType":"TE","Selector":"ML","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText","InputWidth":680,"InputHeight":138},"QuestionDescription":"(Optional) What do you think this research project is studying?","Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"SearchSource":{"AllowFreeResponse":"false"},"QuestionID":"QID83"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"QC","PrimaryAttribute":"Survey Question Count","SecondaryAttribute":"206","TertiaryAttribute":null,"Payload":null},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID175","SecondaryAttribute":"Are all of the possible trends straight lines?","TertiaryAttribute":null,"Payload":{"QuestionText":"Are all of the possible trends straight lines?","DataExportTag":"Q93","QuestionType":"MC","Selector":"SAVR","SubSelector":"TX","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Are all of the possible trends straight lines?","Choices":{"2":{"Display":"Yes"},"3":{"Display":"No"}},"ChoiceOrder":["2","3"],"Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"Language":[],"NextChoiceId":10,"NextAnswerId":1,"QuestionID":"QID175","Randomization":{"Advanced":null,"TotalRandSubset":"","Type":"All"},"DataVisibility":{"Private":false,"Hidden":false},"RecodeValues":{"2":"1","3":"2"}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID195","SecondaryAttribute":"\u2022 Best Guess: - Click here to choose Uncertainty: Click here to choose","TertiaryAttribute":null,"Payload":{"QuestionText":"<div class=\"container\">\n<div style=\"position: relative; display: inline-block;\" id=\"imageContainer\"><img src=\"https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/images\/example.jpg\" id=\"exampleImage\"> <span id=\"dot\" class=\"hidden\">\u2022<\/span><\/div>\n\n<table>\n\t<tbody id=\"probTable\" class=\"hidden\">\n\t<\/tbody>\n<\/table>\n<\/div>\n\n<div id=\"slidersContainer\">\n<div>Best Guess: <span id=\"meanValue\">-<\/span>\n\n<div class=\"slider-wrapper\"><span id=\"instruction1\" class=\"slider-instruction\">Click here to choose<\/span> <input value=\"100\" type=\"range\" step=\"1\" min=\"60\" max=\"140\" id=\"meanSlider\"><\/div>\n<\/div>\n\n<div>Uncertainty:\n<div class=\"slider-wrapper\"><span id=\"instruction2\" class=\"slider-instruction\">Click here to choose<\/span> <input value=\"1.1\" type=\"range\" step=\".01\" min=\"1\" max=\"5\" id=\"varianceSlider\"><\/div>\n<\/div>\n<\/div>","DefaultChoices":false,"QuestionType":"DB","Selector":"TB","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"\u2022 Best Guess: - Click here to choose Uncertainty: Click here to choose","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionJS":"Qualtrics.SurveyEngine.addOnload(function()\n{\n\n\t\n\n});\n\nQualtrics.SurveyEngine.addOnReady(function()\n{\n\t\n\n\tvar surveyEngineInstance = this; \/\/ Store the context for use later\n\t\n\tconsole.log(this.questionId);\n\t\n\t\n\t\n\t\/\/ Function to generate a random permutation of numbers using the Fisher-Yates algorithm\n\tfunction fisherYatesShuffle(array) {\n\t\tfor (let i = array.length - 1; i > 0; i--) {\n\t\t\tconst j = Math.floor(Math.random() * (i + 1));\n\t\t\t[array[i], array[j]] = [array[j], array[i]];\n\t\t}\n\t\treturn array;\n\t}\n\n\t\n\t\n\t\/\/this randomizes them into an order vector if they haven't been assigned yet\n\t\n\t\/\/ Check if randOrder embedded data field exists\n\tlet randOrder = Qualtrics.SurveyEngine.getEmbeddedData('randOrder');\n\tlet conditionNum = Qualtrics.SurveyEngine.getEmbeddedData('conditionNum');\t\n\tif (randOrder) {\n\t\t\/\/ If it exists, parse the string back to an array\n\t\trandOrder = JSON.parse(randOrder);\n\t\tconditionNum = JSON.parse(conditionNum);\n\t} else {\t\n\t\t\/\/ If it doesn't exist, generate the array and then store its stringified version in Qualtrics\n\t\t\t\n\t\t\/\/ Step 1: Generate randOrder array\n\t\tlet numbers = [];\n\t\tfor (let i = 1; i <= 40; i++) {\n    \t\tnumbers.push(i);\n\t\t}\n\t\tfisherYatesShuffle(numbers);\n\t\trandOrder = numbers.slice(0, 15); \/\/ First 15 entries\n\t    \n\t\t\n\t\t\/\/ Step 2: Generate conditionNum array\n\t\tlet conditionValues = [];\n\t\tfor (let i = 1; i <= 4; i++) {\n\t\t\tfor (let j = 0; j < 4; j++) {\n\t\t\t\tconditionValues.push(i);\n\t\t\t}\n\t\t}\n\t\tfisherYatesShuffle(conditionValues);\n\t\tconditionNum = conditionValues.slice(0, 15); \/\/ Randomly shuffled condition numbers\n\n\t\t\n\t\t\/\/ Step 3: Modify conditionNum and randOrder to get some repeats\n\n\t\t\/\/ Array of target values (1, 2, 3) to repeat\n\t\tlet targetValues = [1, 2, 3];\n\n\t\ttargetValues.forEach(value => {\n\t\t\tlet index = conditionNum.indexOf(value); \/\/ Find the first occurrence of the value\n\t\t\tconsole.log(\"index=\"+ index + \"for value\" + value);\n\t\t\tif (index !== -1) {\n\t\t\t\tlet newIndex = Math.min(index + 7, 14); \/\/ Ensure newIndex doesn't exceed 14\n\t\t\t\tconditionNum[newIndex] = value; \/\/ Set conditionNum at newIndex to the same value\n\t\t\t\trandOrder[newIndex] = randOrder[index]; \/\/ Set randOrder at newIndex to randOrder[index]\n\t\t\t}\n\t\t});\n\t\n\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('randOrder', JSON.stringify(randOrder));\n\t\tQualtrics.SurveyEngine.setEmbeddedData('conditionNum', JSON.stringify(conditionNum));\n\t\t\n\t}\n\tconsole.log(\"randOrder: \" + randOrder);\n\tconsole.log(\"conditionNum: \" + conditionNum);\n\t\n\t\n\t\/\/set listeners on sliders\n\tvar sliderMean = document.getElementById(\"meanSlider\");\n\tvar sliderVar = document.getElementById(\"varianceSlider\");\n\tsliderMean.oninput = function() {\n\t\tsurveyEngineInstance.enableNextButton();\n    \tthis.classList.add('show-thumb');  \/\/shows the slider button\n\t\tdocument.getElementById(\"instruction1\").style.display = 'none';  \/\/removes the \"click here\" text\n\t\tupdateMeanValue(this.value);\n  \t};\n\t\n\tsliderVar.oninput = function() {\n\t\tsurveyEngineInstance.enableNextButton();\n\t\tthis.classList.add('show-thumb'); \/\/shows the slider button\n\t\tdocument.getElementById(\"instruction2\").style.display = 'none'; \/\/removes the \"click here\" text\n    \tupdateVarianceValue(this.value);\n  \t};\n\t\n\t function erf(x) {\n        const a1 =  0.254829592;\n        const a2 = -0.284496736;\n        const a3 =  1.421413741;\n        const a4 = -1.453152027;\n        const a5 =  1.061405429;\n        const p  =  0.3275911;\n\n        const sign = (x < 0) ? -1 : 1;\n        x = Math.abs(x);\n\n        const t = 1.0 \/ (1.0 + p * x);\n        const y = (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t;\n\n        return sign * (1 - y * Math.exp(-x * x));\n    }\n\n\t\n     function cdf(x, mean, variance) {\n        return 0.5 * (1 + erf((x - mean) \/ Math.sqrt(2 * variance)));\n    }\n   \n\n\tfunction updateVarianceValue(value) {\n        \/\/document.getElementById('varianceValue').textContent = value;\n        computeProbabilities();\n        saveDataToQualtrics();\n    }\n\n\t\n    function updateMeanValue(value) {\n        document.getElementById('meanValue').textContent = value; \/\/display the mean for the person to see\n\t\tcomputeProbabilities();\n        adjustDotPosition();\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\/\/this just ensures everything is fine if the person changes their window size\n\t\n\t\/\/window.addEventListener('resize', function() {\n\t\/\/\tcomputeProbabilities();\n\t\/\/\tadjustDotPosition();\n\t\/\/});\n\n\n\tfunction adjustDotPosition() {\n\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\t\n\t\tconst slider = document.getElementById('meanSlider');\n\t\tconst dot = document.getElementById('dot');\n\t\tconst image = document.getElementById('exampleImage');\n\n\t\tconst sliderRange = 140-60;\n\t\tconst sliderPosition = (parseFloat(slider.value) - 60) \/ sliderRange;\n\t\t\n\t\tconst imageHeight = image.offsetHeight;\n\t\tconst imageWidth = image.offsetWidth-22;\n\t\tconst dotHeight = dot.offsetHeight;\n\n\t\t\/\/ Calculate the top position based on the image height and the slider's value.\n\t\tconst topPosition = 18+.78*(imageHeight * (1 - sliderPosition) - dotHeight \/ 2);\n\t\t\n\t\tdot.style.top = topPosition + \"px\";\n\t\tdot.style.left = imageWidth + \"px\"; \/\/ Ensure dot is on the right side of the image.\n\t}\n\n\n    function computeProbabilities() {\n        \n        const mean = parseFloat(document.getElementById('meanSlider').value);\n\t\t\/\/the formula below takes var -> the slider is in root(SD) so needs to be ^4\n        const variance = Math.pow(parseFloat(document.getElementById('varianceSlider').value),4);\n        const intervals = [[130,140],[120,130],[110,120],[100,110],[90,100],[80,90],[70,80],[60,70]];\n        const letters = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\"];\n\n\t\t\/\/this makes sure the heights line up with the picture \n\t\tconst imgHeight = document.getElementById('exampleImage').offsetHeight;\n        const spacerPercentage1 = 0.04;\n        const spacerHeight1 = imgHeight * spacerPercentage1;\n        const spacerPercentage2 = 0.22;\n        const spacerHeight2 = imgHeight * spacerPercentage2;\n        const letterRowHeight = (imgHeight - (spacerHeight1+spacerHeight2)) \/ 8;  \/\/ subtracting the two spacer rows and dividing by # rows\n\n        const tbody = document.getElementById('probTable');\t\t\n\t\ttbody.innerHTML = '';\n\t\ttbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n        intervals.forEach((interval, index) => {\n            const prob = (cdf(interval[1], mean, variance) - cdf(interval[0], mean, variance)) * 100;\n           \n            \/\/ Create a bar inside a container\n            const bar = '<div class=\"bar-container\"><div class=\"bar\" style=width:'+prob+'%;\"><\/div><\/div>';\n\n            const row ='<tr height='+letterRowHeight+'px><td>'+bar+'<\/td><td width=200>'+prob.toFixed(1)+'%<\/td><\/tr>';\n           \n            tbody.innerHTML += row;\n        });\n        tbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n    }\n\t\t\n\tfunction randomizeImage() {\n\t\tconst image = document.getElementById('exampleImage');\n\t\t\/\/ Now, you can use `randOrder` in the current page\n\t\tconst imageNumber = randOrder[window.loopCounter - 1];\n\t\tconst conditionNumber = conditionNum[window.loopCounter - 1];\n\t\timage.src = 'https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/images_4\/'+imageNumber+\"_\"+conditionNumber+'.jpeg';\n\t\tconsole.log(image.src);\n\t}\n\n\tfunction saveDataToQualtrics() {\n\t\tvar sliderMean = document.getElementById(\"meanSlider\").value;\n\t\t\/\/we are recording in SD -> the slider is in root(SD)\n\t\tvar sliderVar = Math.pow(parseFloat(document.getElementById('varianceSlider').value),2);\n\t\tconst condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\t\n\t\t\/\/so, this is hacky, but randomizing images but not the test images, so want to store test images as -2,-1...\n\t\tlet imageNumber=window.loopCounter;\n\t\tlet conditionNumber=window.loopCounter;\n\t\tif (window.loopCounter>0) {\n\t\t\timageNumber = randOrder[window.loopCounter - 1];\n\t\t\tconditionNumber = conditionNum[window.loopCounter - 1];\n\t\t}\n\t\tvar combinedData = window.currentData + window.loopCounter + \"~\" + condition+ \"~\" +imageNumber+\"_\"+ conditionNumber +'.jpeg~' + sliderMean + \"~\" + sliderVar + \"~\";\n\t\tQualtrics.SurveyEngine.setEmbeddedData('allSliderData', combinedData);\n\t\tconsole.log(\"allSliderData:\"+Qualtrics.SurveyEngine.getEmbeddedData('allSliderData'));\n    \n\t}\t\n\n\n\n\tfunction adjustRedArea(sliderId, areaId, correctValue, range) {\n\t\tconst slider = document.getElementById(sliderId);\n\t\tconst redArea = document.getElementById(areaId);\n\n\t\tconst totalWidth = slider.offsetWidth;\n\t\tconst minValue = parseFloat(slider.min);\n\t\tconst maxValue = parseFloat(slider.max);\n\n\t\tconst startValue = correctValue - range;\n\t\tconst endValue = correctValue + range;\n\t\t\n\t\tconst thumbWidth = 3; \/\/ Assuming 20px is your thumb width\n\n        const startPos = (startValue - minValue) \/ (maxValue - minValue) * 100 + thumbWidth;\n        const endPos = (endValue - minValue) \/ (maxValue - minValue) * 100 + thumbWidth;\n\n\t\tredArea.style.left = startPos+\"%\";\n\t\twidthPos=endPos-startPos;\n\t\tredArea.style.width = widthPos+\"%\";\n\t\tredArea.style.display = 'block'; \/\/ show the red area\n\t}\n\n\t\n\t\/\/for instructions, person wants to see the answers.\n\tif (document.getElementById('checkAnswer')) {\n\t\t\n\t\t\/\/so they don't get the next button until they press\n\t\t surveyEngineInstance.disableNextButton();\n\n\t   document.getElementById('checkAnswer').addEventListener('click', function() {\n\t\t    surveyEngineInstance.enableNextButton();\n\t\t   \n\t\t   \/\/ Example correct answer values. You can set these dynamically based on your data.\n\t\t  const correctMean = parseFloat(document.getElementById('correctMean').value);\n\t\t  const correctVariance = parseFloat(document.getElementById('correctVariance').value);\n\n\t\t  \/\/ Calculate positions for the red area -> the last variables have the size of the bonus area\n\t\t  adjustRedArea('meanSlider', 'meanRedArea', correctMean, 4);\n\t\t  adjustRedArea('varianceSlider', 'varianceRedArea', correctVariance, 0.25);\n\t\t\n\t\t  document.getElementById('predictionDesc').classList.remove('hidden');\n\t   });\n\t}\t\n\t\n\t\n\t\/\/for instructions: if there is a \"show prediction button\"\n\tif (document.getElementById(\"showPrediction\")) {\n\t\t surveyEngineInstance.disableNextButton();\n\t\tdocument.getElementById(\"showPrediction\").addEventListener(\"click\", function() {\n\t\t\t surveyEngineInstance.enableNextButton();\n\t\t\t\/\/ Show the table (with bars)\n\t\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\t\tdocument.getElementById('predictionDesc').classList.remove('hidden');\n\n\t\t\tcomputeProbabilities();\n\t\t\tadjustDotPosition();\t\t\n\t\t});\n\t};\n\n\n\t\n\t\/\/if we are in question with a slider bar\n\n\tif (document.getElementById('meanValue')) {\t\t\n\t\t surveyEngineInstance.disableNextButton();\n\t\t\/\/want to keep track of the loop number\n\t\twindow.loopCounter = parseInt(Qualtrics.SurveyEngine.getEmbeddedData('loopCounter'));\n\t\tconsole.log(\"-> retreived loop number:\"+loopCounter);\n\t\t\n\t\t\/\/update the loop number\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('loopCounter', loopCounter+1);\n\t\tconst loopCounterNew=window.loopCounter+1;\n\t\tconsole.log(\"-> updated loop number to \" +loopCounterNew);\n\t\t\n\t\t\/\/want to keep this stable so we can add to it:\n\t\twindow.currentData = Qualtrics.SurveyEngine.getEmbeddedData('allSliderData') || \"\";\n\t\t\n\t\t\/\/randomizing the image prefix\n\t\t\/\/const condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\t\/\/window.prefix = \n\t\t\/\/(condition === \"cl\" && window.loopCounter <= 6) ? \"cl\" :\n\t\t\/\/(condition === \"cl\") ? \"fn\" :\n\t\t\/\/(condition === \"cn\" && window.loopCounter <= 6) ? \"cn\" :\n\t\t\/\/(condition === \"cn\") ? \"fl\" :\n\t\t\/\/(condition === \"fl\" && window.loopCounter <= 6) ? \"fl\" :\n\t\t\/\/(condition === \"fl\") ? \"cn\" :\n\t\t\/\/(condition === \"fn\" && window.loopCounter <= 6) ? \"fn\" :\n\t\t\/\/(condition === \"fn\") ? \"cl\" : \n\t\t\"\"; \/\/ default value, in case no conditions are met\n\t\t\n\t\t\/\/if we are in the main area, need to change image\n\t\tif (this.questionId.includes(\"QID195\")) {\n\t\t\trandomizeImage();\n\t\t}\n\t\t\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\n});\n\nQualtrics.SurveyEngine.addOnUnload(function()\n{\n\t\/*Place your JavaScript here to run when the page is unloaded*\/\n\n});","DataVisibility":{"Private":false,"Hidden":false},"QuestionText_Unsafe":"<style type=\"text\/css\">table td:nth-child(2) { \/* Column for percentages *\/\n    width: 50px;\n    text-align: left;\n}\n   \/* Styles for the sliders *\/\ninput[type=range] {\n    -webkit-appearance: none;\n    width: 100%;\n    background: transparent;\n    outline: none;\n}\n\ninput[type=range]::-webkit-slider-thumb {\n    -webkit-appearance: none;\n    appearance: none;\n    margin-top: -6px; \/* Adjust this to center the dot on the slider bar *\/\n    width: 20px;\n    height: 20px;\n    background: linear-gradient(145deg, #3b98db, #2c8ad4);\n    cursor: pointer;\n    border-radius: 50%;\n    box-shadow:  3px 3px 5px #b5b5b5, \n                -3px -3px 5px #ffffff;\n}\n\ninput[type=range]::-moz-range-thumb {\n    margin-top: -6px;\n    width: 20px;\n    height: 20px;\n    background: linear-gradient(145deg, #3b98db, #2c8ad4);\n    cursor: pointer;\n    border-radius: 50%;\n    box-shadow:  3px 3px 5px #b5b5b5, \n                -3px -3px 5px #ffffff;\n}\n\ninput[type=range]::-webkit-slider-runnable-track {\n    width: 20%;\n    height: 8px;\n    cursor: pointer;\n    background: #E0E0E0;\n    border-radius: 4px;\n    box-shadow:  inset 2px 2px 5px #b5b5b5, \n                inset -3px -3px 5px #ffffff;\n}\n\ninput[type=range]::-moz-range-track {\n    width: 20%;\n    height: 8px;\n    cursor: pointer;\n    background: #E0E0E0;\n    border-radius: 4px;\n    box-shadow:  inset 2px 2px 5px #b5b5b5, \n                inset -3px -3px 5px #ffffff;\n}\n\ninput[type=range]::-moz-focus-outer {\n    border: 0;\n}\n\n#slidersContainer {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 20px;  \/* Spacing between the sliders *\/\n    margin-top: 20px; \/* Spacing above the sliders. Adjust as needed. *\/\n}\n\n#slidersContainer > div {\n    width: 30%;  \/* Added this line to give each slider container 50% width *\/\n}\n\n\n      .container {\n            display: flex;\n            align-items: flex-start;\n        }\n\n        img {\n            max-width: 100%;\n        }\n\n        table {\n            margin-left: 10px;\n            padding: 0;\n        }\n\n        td {\n            width: 20px;\n            text-align: center;\n            padding: 0;\n        }\n        \/* Styling for the bars *\/\n        .bar-container {\n            width: 50px;  \/* Set a max width for the bars *\/\n            border: 1px solid #aaa;\n            padding:0px;\n        }\n\n        .bar {\n            background-color: #3498db;\n            height: 20px;\n        }\n\n#dot {\n    position: absolute;\n    background-color: gray;  \/* Add this to make it a gray dot *\/\n    width: 20px;   \/* Define the size of the dot *\/\n    height: 20px;\n    border-radius: 50%;   \/* Make the dot circular *\/\n    color: transparent;  \/* Hide the \"x\" text color *\/\n    text-align: center;\n    line-height: 20px; \/* Vertically center the \"x\", in case you switch back *\/\n}\n\n#imageContainer {\n    position: relative;\n    display: inline-flex;   \/* use flex to ensure it covers both the image and dot *\/\n    align-items: flex-start; \/* align content to the top *\/\n}\n\n<\/style>\nSandbox\n\n<div class=\"container\">\n <div id=\"imageContainer\" style=\"position: relative; display: inline-block;\">\n  <img id=\"exampleImage\" src=\"https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/problem6.png\" \/>\n  <span id=\"dot\">&#8226;<\/span>\n <\/div>\n <table>\n  <tbody id=\"probTable\">\n  <\/tbody>\n <\/table>\n<\/div>\n\n<div id=\"slidersContainer\">\n    <div>\n        Best Guess: <span id=\"meanValue\">100<\/span><br \/>\n        <input id=\"meanSlider\" max=\"140\" min=\"60\" step=\"1\" type=\"range\" value=\"100\" \/>\n    <\/div>\n    <div>\n        Spread:<br \/>\n        <input id=\"varianceSlider\" max=\"25\" min=\".1\" step=\"1\" type=\"range\" value=\".1\" \/>\n    <\/div>\n<\/div>","DataExportTag":"Q195","QuestionID":"QID195"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID196","SecondaryAttribute":"Click to write the question text","TertiaryAttribute":null,"Payload":{"QuestionText":"Click to write the question text","DefaultChoices":false,"DataExportTag":"Q29","QuestionType":"TE","Selector":"SL","Configuration":{"QuestionDescriptionOption":"UseText","InputWidth":580,"InputHeight":29},"QuestionDescription":"Click to write the question text","Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"SearchSource":{"AllowFreeResponse":"false"},"QuestionID":"QID196"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID201","SecondaryAttribute":"Click to write the question text","TertiaryAttribute":null,"Payload":{"QuestionText":"Click to write the question text","DefaultChoices":false,"DataExportTag":"Q34","QuestionID":"QID201","QuestionType":"Meta","Selector":"Browser","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Click to write the question text","Choices":{"1":{"Display":"Browser","TextEntry":1},"2":{"Display":"Version","TextEntry":1},"3":{"Display":"Operating System","TextEntry":1},"4":{"Display":"Screen Resolution","TextEntry":1},"5":{"Display":"Flash Version","TextEntry":1},"6":{"Display":"Java Support","TextEntry":1},"7":{"Display":"User Agent","TextEntry":1}},"Validation":"None","GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID173","SecondaryAttribute":"Comprehension test\u00a0","TertiaryAttribute":null,"Payload":{"QuestionText":"<u><strong><span style=\"font-size:19px;\">Comprehension test&nbsp;<\/span><\/strong><\/u>","DefaultChoices":false,"DataExportTag":"Q91","QuestionID":"QID173","QuestionType":"DB","Selector":"TB","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Comprehension test\u00a0","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID1","SecondaryAttribute":"Consent Form - University of California at Berkeley This is a research study about beliefs, proba...","TertiaryAttribute":null,"Payload":{"QuestionText":"<div style=\"text-align: center;\"><span style=\"font-size:22px;\"><u><strong>Consent Form - University of California at Berkeley<\/strong><\/u><\/span><\/div>\n<br \/>\nThis is a research study about beliefs, probabilities, and uncertainty.<br \/>\n<br \/>\nIf you choose to participate, you will play a game in which you need to use evidence to make some predictions. The survey could take approximately 20 minutes to complete. You will earn a $4 base payment.<br \/>\n<br \/>\nOnly those who are over 18 years old can participate in this survey, and <span style=\"color:#e74c3c;\">you must use a laptop or desktop<\/span> (not a small device like a phone).&nbsp;&nbsp;<br \/>\n<br \/>\nAnonymized data from this study will be posted online for scientific peer review. If you have questions about the study, contact Professor Don Moore &lt;dm@berkeley.edu&gt;. If you have questions about your rights as a research participant, you may contact Berkeley&#39;s Office for the Protection of Human Subjects&nbsp;&lt;ophs@berkeley.edu&gt;.&nbsp;&nbsp;","DefaultChoices":false,"DataExportTag":"Q1","QuestionID":"QID1","QuestionType":"DB","Selector":"TB","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Consent Form - University of California at Berkeley This is a research study about beliefs, proba...","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"DataVisibility":{"Private":false,"Hidden":false},"QuestionJS":"Qualtrics.SurveyEngine.addOnload(function()\n{\n\t\/*Place your JavaScript here to run when the page loads*\/\n\n});\n\nQualtrics.SurveyEngine.addOnReady(function()\n{\n\t\/*Place your JavaScript here to run when the page is fully displayed*\/\n\tQualtrics.SurveyEngine.setCurrentPage(195); \/\/ Adjust to the correct page number\n\n\n});\n\nQualtrics.SurveyEngine.addOnUnload(function()\n{\n\t\/*Place your JavaScript here to run when the page is unloaded*\/\n\n});"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID38","SecondaryAttribute":"Did the sliders work okay for you? ","TertiaryAttribute":null,"Payload":{"QuestionText":"Did the sliders work okay for you?&nbsp;","DefaultChoices":false,"DataExportTag":"Comments","QuestionType":"TE","Selector":"ML","Configuration":{"QuestionDescriptionOption":"UseText","InputWidth":680,"InputHeight":60},"QuestionDescription":"Did the sliders work okay for you? ","Validation":{"Settings":{"ForceResponse":"ON","ForceResponseType":"ON","Type":"None","MinChars":"1"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"SearchSource":{"AllowFreeResponse":"false"},"QuestionID":"QID38","DataVisibility":{"Private":false,"Hidden":false}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID191","SecondaryAttribute":"Each store has a long-term trend in average sales over time. This trend can be rising, falling or...","TertiaryAttribute":null,"Payload":{"QuestionText":"Each store has a <b>long-term trend in average sales<\/b> over time. This trend can be rising, falling or flat. But, <b>sales on a given day can be above or below this average.<\/b><br>\n<br>\nFor example, consider the following graph:\n<div class=\"container\">\n<div style=\"position: relative; display: inline-block;\" id=\"imageContainer\"><img src=\"https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/train1.jpeg\" id=\"exampleImage\"> <span id=\"dot\" class=\"hidden\">\u2022<\/span><\/div>\n\n<table>\n <tbody id=\"probTable\" class=\"hidden\">\n <\/tbody>\n<\/table>\n<\/div>\n\n<div style=\"display: none;\" id=\"slidersContainer\"><input value=\"132.7\" type=\"hidden\" id=\"meanSlider\"> <input value=\"1.19\" type=\"hidden\" id=\"varianceSlider\"><\/div>\nThe dots show sales over time and the line represents the trend. Each day (as you move to the right), the trend is rising. So, <b>average sales are rising steadily over time<\/b> and there is very little change from this average. \n\n<br><br>\nThis makes it pretty easy to predict sales for day 20 (<b>marked by the vertical red line<\/b>) - they are likely close to the trend line. Think about how likely you think sales will end in each bin - the bins are represented by the horizontal lines on the graph (such as 90-100, 100-110, etc.).<br>\n<br>\n<button id=\"showPrediction\">Click here to see the right prediction<\/button><br>\n<span id=\"predictionDesc\" class=\"hidden\">The dot represents the best forecast of average level of sales on the chosen day - right on the trend line. The percentages represent the likelihood that sales end in each bin. Because sales don\u2019t really vary day-by-day, there is a very high chance that sales will exactly follow the trend and end in the bin 130-140 or 120-130.<\/span>","DefaultChoices":false,"DataExportTag":"Instructions2","QuestionType":"DB","Selector":"TB","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Each store has a long-term trend in average sales over time. This trend can be rising, falling or...","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID191","QuestionJS":"Qualtrics.SurveyEngine.addOnload(function()\n{\n\n\t\n\n});\n\nQualtrics.SurveyEngine.addOnReady(function()\n{\n\t\n\n\tvar surveyEngineInstance = this; \/\/ Store the context for use later\n\t\n\tconsole.log(this.questionId);\n\t\n\t\n\t\n\t\/\/ Function to generate a random permutation of numbers using the Fisher-Yates algorithm\n\tfunction fisherYatesShuffle(array) {\n\t\tfor (let i = array.length - 1; i > 0; i--) {\n\t\t\tconst j = Math.floor(Math.random() * (i + 1));\n\t\t\t[array[i], array[j]] = [array[j], array[i]];\n\t\t}\n\t\treturn array;\n\t}\n\n\t\n\t\n\t\/\/this randomizes them into an order vector if they haven't been assigned yet\n\t\n\t\/\/ Check if randOrder embedded data field exists\n\tlet randOrder = Qualtrics.SurveyEngine.getEmbeddedData('randOrder');\n\tlet conditionNum = Qualtrics.SurveyEngine.getEmbeddedData('conditionNum');\t\n\tif (randOrder) {\n\t\t\/\/ If it exists, parse the string back to an array\n\t\trandOrder = JSON.parse(randOrder);\n\t\tconditionNum = JSON.parse(conditionNum);\n\t} else {\t\n\t\t\/\/ If it doesn't exist, generate the array and then store its stringified version in Qualtrics\n\t\t\t\n\t\t\/\/ Step 1: Generate randOrder array\n\t\tlet numbers = [];\n\t\tfor (let i = 1; i <= 40; i++) {\n    \t\tnumbers.push(i);\n\t\t}\n\t\tfisherYatesShuffle(numbers);\n\t\trandOrder = numbers.slice(0, 15); \/\/ First 15 entries\n\t    \n\t\t\n\t\t\/\/ Step 2: Generate conditionNum array\n\t\tlet conditionValues = [];\n\t\tfor (let i = 1; i <= 4; i++) {\n\t\t\tfor (let j = 0; j < 4; j++) {\n\t\t\t\tconditionValues.push(i);\n\t\t\t}\n\t\t}\n\t\tfisherYatesShuffle(conditionValues);\n\t\tconditionNum = conditionValues.slice(0, 15); \/\/ Randomly shuffled condition numbers\n\n\t\t\n\t\t\/\/ Step 3: Modify conditionNum and randOrder to get some repeats\n\n\t\t\/\/ Array of target values (1, 2, 3) to repeat\n\t\tlet targetValues = [1, 2, 3];\n\n\t\ttargetValues.forEach(value => {\n\t\t\tlet index = conditionNum.indexOf(value); \/\/ Find the first occurrence of the value\n\t\t\tconsole.log(\"index=\"+ index + \"for value\" + value);\n\t\t\tif (index !== -1) {\n\t\t\t\tlet newIndex = Math.min(index + 7, 14); \/\/ Ensure newIndex doesn't exceed 14\n\t\t\t\tconditionNum[newIndex] = value; \/\/ Set conditionNum at newIndex to the same value\n\t\t\t\trandOrder[newIndex] = randOrder[index]; \/\/ Set randOrder at newIndex to randOrder[index]\n\t\t\t}\n\t\t});\n\t\n\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('randOrder', JSON.stringify(randOrder));\n\t\tQualtrics.SurveyEngine.setEmbeddedData('conditionNum', JSON.stringify(conditionNum));\n\t\t\n\t}\n\tconsole.log(\"randOrder: \" + randOrder);\n\tconsole.log(\"conditionNum: \" + conditionNum);\n\t\n\t\n\t\/\/set listeners on sliders\n\tvar sliderMean = document.getElementById(\"meanSlider\");\n\tvar sliderVar = document.getElementById(\"varianceSlider\");\n\tsliderMean.oninput = function() {\n\t\tsurveyEngineInstance.enableNextButton();\n    \tthis.classList.add('show-thumb');  \/\/shows the slider button\n\t\tdocument.getElementById(\"instruction1\").style.display = 'none';  \/\/removes the \"click here\" text\n\t\tupdateMeanValue(this.value);\n  \t};\n\t\n\tsliderVar.oninput = function() {\n\t\tsurveyEngineInstance.enableNextButton();\n\t\tthis.classList.add('show-thumb'); \/\/shows the slider button\n\t\tdocument.getElementById(\"instruction2\").style.display = 'none'; \/\/removes the \"click here\" text\n    \tupdateVarianceValue(this.value);\n  \t};\n\t\n\t function erf(x) {\n        const a1 =  0.254829592;\n        const a2 = -0.284496736;\n        const a3 =  1.421413741;\n        const a4 = -1.453152027;\n        const a5 =  1.061405429;\n        const p  =  0.3275911;\n\n        const sign = (x < 0) ? -1 : 1;\n        x = Math.abs(x);\n\n        const t = 1.0 \/ (1.0 + p * x);\n        const y = (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t;\n\n        return sign * (1 - y * Math.exp(-x * x));\n    }\n\n\t\n     function cdf(x, mean, variance) {\n        return 0.5 * (1 + erf((x - mean) \/ Math.sqrt(2 * variance)));\n    }\n   \n\n\tfunction updateVarianceValue(value) {\n        \/\/document.getElementById('varianceValue').textContent = value;\n        computeProbabilities();\n        saveDataToQualtrics();\n    }\n\n\t\n    function updateMeanValue(value) {\n        document.getElementById('meanValue').textContent = value; \/\/display the mean for the person to see\n\t\tcomputeProbabilities();\n        adjustDotPosition();\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\/\/this just ensures everything is fine if the person changes their window size\n\t\n\t\/\/window.addEventListener('resize', function() {\n\t\/\/\tcomputeProbabilities();\n\t\/\/\tadjustDotPosition();\n\t\/\/});\n\n\n\tfunction adjustDotPosition() {\n\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\t\n\t\tconst slider = document.getElementById('meanSlider');\n\t\tconst dot = document.getElementById('dot');\n\t\tconst image = document.getElementById('exampleImage');\n\n\t\tconst sliderRange = 140-60;\n\t\tconst sliderPosition = (parseFloat(slider.value) - 60) \/ sliderRange;\n\t\t\n\t\tconst imageHeight = image.offsetHeight;\n\t\tconst imageWidth = image.offsetWidth-22;\n\t\tconst dotHeight = dot.offsetHeight;\n\n\t\t\/\/ Calculate the top position based on the image height and the slider's value.\n\t\tconst topPosition = 18+.78*(imageHeight * (1 - sliderPosition) - dotHeight \/ 2);\n\t\t\n\t\tdot.style.top = topPosition + \"px\";\n\t\tdot.style.left = imageWidth + \"px\"; \/\/ Ensure dot is on the right side of the image.\n\t}\n\n\n    function computeProbabilities() {\n        \n        const mean = parseFloat(document.getElementById('meanSlider').value);\n\t\t\/\/the formula below takes var -> the slider is in root(SD) so needs to be ^4\n        const variance = Math.pow(parseFloat(document.getElementById('varianceSlider').value),4);\n        const intervals = [[130,140],[120,130],[110,120],[100,110],[90,100],[80,90],[70,80],[60,70]];\n        const letters = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\"];\n\n\t\t\/\/this makes sure the heights line up with the picture \n\t\tconst imgHeight = document.getElementById('exampleImage').offsetHeight;\n        const spacerPercentage1 = 0.04;\n        const spacerHeight1 = imgHeight * spacerPercentage1;\n        const spacerPercentage2 = 0.22;\n        const spacerHeight2 = imgHeight * spacerPercentage2;\n        const letterRowHeight = (imgHeight - (spacerHeight1+spacerHeight2)) \/ 8;  \/\/ subtracting the two spacer rows and dividing by # rows\n\n        const tbody = document.getElementById('probTable');\t\t\n\t\ttbody.innerHTML = '';\n\t\ttbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n        intervals.forEach((interval, index) => {\n            const prob = (cdf(interval[1], mean, variance) - cdf(interval[0], mean, variance)) * 100;\n           \n            \/\/ Create a bar inside a container\n            const bar = '<div class=\"bar-container\"><div class=\"bar\" style=width:'+prob+'%;\"><\/div><\/div>';\n\n            const row ='<tr height='+letterRowHeight+'px><td>'+bar+'<\/td><td width=200>'+prob.toFixed(1)+'%<\/td><\/tr>';\n           \n            tbody.innerHTML += row;\n        });\n        tbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n    }\n\t\t\n\tfunction randomizeImage() {\n\t\tconst image = document.getElementById('exampleImage');\n\t\t\/\/ Now, you can use `randOrder` in the current page\n\t\tconst imageNumber = randOrder[window.loopCounter - 1];\n\t\tconst conditionNumber = conditionNum[window.loopCounter - 1];\n\t\timage.src = 'https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/images_4\/'+imageNumber+\"_\"+conditionNumber+'.jpeg';\n\t\tconsole.log(image.src);\n\t}\n\n\tfunction saveDataToQualtrics() {\n\t\tvar sliderMean = document.getElementById(\"meanSlider\").value;\n\t\t\/\/we are recording in SD -> the slider is in root(SD)\n\t\tvar sliderVar = Math.pow(parseFloat(document.getElementById('varianceSlider').value),2);\n\t\tconst condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\t\n\t\t\/\/so, this is hacky, but randomizing images but not the test images, so want to store test images as -2,-1...\n\t\tlet imageNumber=window.loopCounter;\n\t\tlet conditionNumber=window.loopCounter;\n\t\tif (window.loopCounter>0) {\n\t\t\timageNumber = randOrder[window.loopCounter - 1];\n\t\t\tconditionNumber = conditionNum[window.loopCounter - 1];\n\t\t}\n\t\tvar combinedData = window.currentData + window.loopCounter + \"~\" + condition+ \"~\" +imageNumber+\"_\"+ conditionNumber +'.jpeg~' + sliderMean + \"~\" + sliderVar + \"~\";\n\t\tQualtrics.SurveyEngine.setEmbeddedData('allSliderData', combinedData);\n\t\tconsole.log(\"allSliderData:\"+Qualtrics.SurveyEngine.getEmbeddedData('allSliderData'));\n    \n\t}\t\n\n\n\n\tfunction adjustRedArea(sliderId, areaId, correctValue, range) {\n\t\tconst slider = document.getElementById(sliderId);\n\t\tconst redArea = document.getElementById(areaId);\n\n\t\tconst totalWidth = slider.offsetWidth;\n\t\tconst minValue = parseFloat(slider.min);\n\t\tconst maxValue = parseFloat(slider.max);\n\n\t\tconst startValue = correctValue - range;\n\t\tconst endValue = correctValue + range;\n\t\t\n\t\tconst thumbWidth = 3; \/\/ Assuming 20px is your thumb width\n\n        const startPos = (startValue - minValue) \/ (maxValue - minValue) * 100 + thumbWidth;\n        const endPos = (endValue - minValue) \/ (maxValue - minValue) * 100 + thumbWidth;\n\n\t\tredArea.style.left = startPos+\"%\";\n\t\twidthPos=endPos-startPos;\n\t\tredArea.style.width = widthPos+\"%\";\n\t\tredArea.style.display = 'block'; \/\/ show the red area\n\t}\n\n\t\n\t\/\/for instructions, person wants to see the answers.\n\tif (document.getElementById('checkAnswer')) {\n\t\t\n\t\t\/\/so they don't get the next button until they press\n\t\t surveyEngineInstance.disableNextButton();\n\n\t   document.getElementById('checkAnswer').addEventListener('click', function() {\n\t\t    surveyEngineInstance.enableNextButton();\n\t\t   \n\t\t   \/\/ Example correct answer values. You can set these dynamically based on your data.\n\t\t  const correctMean = parseFloat(document.getElementById('correctMean').value);\n\t\t  const correctVariance = parseFloat(document.getElementById('correctVariance').value);\n\n\t\t  \/\/ Calculate positions for the red area -> the last variables have the size of the bonus area\n\t\t  adjustRedArea('meanSlider', 'meanRedArea', correctMean, 4);\n\t\t  adjustRedArea('varianceSlider', 'varianceRedArea', correctVariance, 0.25);\n\t\t\n\t\t  document.getElementById('predictionDesc').classList.remove('hidden');\n\t   });\n\t}\t\n\t\n\t\n\t\/\/for instructions: if there is a \"show prediction button\"\n\tif (document.getElementById(\"showPrediction\")) {\n\t\t surveyEngineInstance.disableNextButton();\n\t\tdocument.getElementById(\"showPrediction\").addEventListener(\"click\", function() {\n\t\t\t surveyEngineInstance.enableNextButton();\n\t\t\t\/\/ Show the table (with bars)\n\t\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\t\tdocument.getElementById('predictionDesc').classList.remove('hidden');\n\n\t\t\tcomputeProbabilities();\n\t\t\tadjustDotPosition();\t\t\n\t\t});\n\t};\n\n\n\t\n\t\/\/if we are in question with a slider bar\n\n\tif (document.getElementById('meanValue')) {\t\t\n\t\t surveyEngineInstance.disableNextButton();\n\t\t\/\/want to keep track of the loop number\n\t\twindow.loopCounter = parseInt(Qualtrics.SurveyEngine.getEmbeddedData('loopCounter'));\n\t\tconsole.log(\"-> retreived loop number:\"+loopCounter);\n\t\t\n\t\t\/\/update the loop number\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('loopCounter', loopCounter+1);\n\t\tconst loopCounterNew=window.loopCounter+1;\n\t\tconsole.log(\"-> updated loop number to \" +loopCounterNew);\n\t\t\n\t\t\/\/want to keep this stable so we can add to it:\n\t\twindow.currentData = Qualtrics.SurveyEngine.getEmbeddedData('allSliderData') || \"\";\n\t\t\n\t\t\/\/randomizing the image prefix\n\t\t\/\/const condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\t\/\/window.prefix = \n\t\t\/\/(condition === \"cl\" && window.loopCounter <= 6) ? \"cl\" :\n\t\t\/\/(condition === \"cl\") ? \"fn\" :\n\t\t\/\/(condition === \"cn\" && window.loopCounter <= 6) ? \"cn\" :\n\t\t\/\/(condition === \"cn\") ? \"fl\" :\n\t\t\/\/(condition === \"fl\" && window.loopCounter <= 6) ? \"fl\" :\n\t\t\/\/(condition === \"fl\") ? \"cn\" :\n\t\t\/\/(condition === \"fn\" && window.loopCounter <= 6) ? \"fn\" :\n\t\t\/\/(condition === \"fn\") ? \"cl\" : \n\t\t\"\"; \/\/ default value, in case no conditions are met\n\t\t\n\t\t\/\/if we are in the main area, need to change image\n\t\tif (this.questionId.includes(\"QID195\")) {\n\t\t\trandomizeImage();\n\t\t}\n\t\t\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\n});\n\nQualtrics.SurveyEngine.addOnUnload(function()\n{\n\t\/*Place your JavaScript here to run when the page is unloaded*\/\n\n});"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID203","SecondaryAttribute":"Here is another example. Try your best to get the right answer - then click the button to see if...","TertiaryAttribute":null,"Payload":{"QuestionText":"Here is another example. Try your best to get the right answer - then click the button to see if you would have gotten close enough to the right answer to get a bonus.<div class=\"container\">\n <div id=\"imageContainer\" style=\"position: relative; display: inline-block;\">\n  <img id=\"exampleImage\" src=\"https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/practice2.jpeg\">\n  <span id=\"dot\" class=\"hidden\">\u2022<\/span>\n <\/div>\n <table>\n  <tbody id=\"probTable\" class=\"hidden\">\n  <\/tbody>\n <\/table>\n<\/div>\n\n<input type=\"hidden\" id=\"correctMean\" value=\"78\">\n<input type=\"hidden\" id=\"correctVariance\" value=\"3.95\">\n\n\n<div id=\"slidersContainer\">\n    <div>\n        Best Guess: <span id=\"meanValue\">-<\/span><br>\n        <div class=\"slider-wrapper\">\n             <span id=\"instruction1\" class=\"slider-instruction\">Click here to choose<\/span>\n             <input value=\"100\" type=\"range\" step=\"1\" min=\"60\" max=\"140\" id=\"meanSlider\">\n             <div id=\"meanRedArea\" class=\"red-area\">\n                   <span class=\"exact-answer\">\u2022<\/span>\n             <\/div>\n       <\/div>   \n    <\/div>\n\n  \n    <div>\n        Uncertainty:<br>\n        <div class=\"slider-wrapper\">\n             <span id=\"instruction2\" class=\"slider-instruction\">Click here to choose<\/span>\n             <input value=\"1.1\" type=\"range\" step=\".01\" min=\"1\" max=\"5\" id=\"varianceSlider\">\n             <div id=\"varianceRedArea\" class=\"red-area\">\n                   <span class=\"exact-answer\">\u2022<\/span>\n             <\/div>\n       <\/div>         \n\n\n    <\/div>\n<\/div>\n\n<br>\n<button id=\"checkAnswer\">Click here to show the right answer on the sliders<\/button>\n<span class=\"hidden\" id=\"predictionDesc\">\n\n<br><br>As before, the red dot shows you the right answer and the orange area shows how close you have to be to get the bonus.\n<br><br>\nMove the sliders to the right answer to make sure you know the right answer for this example.\n<\/span>","QuestionJS":"Qualtrics.SurveyEngine.addOnload(function()\n{\n\n\t\n\n});\n\nQualtrics.SurveyEngine.addOnReady(function()\n{\n\t\n\n\tvar surveyEngineInstance = this; \/\/ Store the context for use later\n\t\n\tconsole.log(this.questionId);\n\t\n\t\n\t\n\t\/\/ Function to generate a random permutation of numbers using the Fisher-Yates algorithm\n\tfunction fisherYatesShuffle(array) {\n\t\tfor (let i = array.length - 1; i > 0; i--) {\n\t\t\tconst j = Math.floor(Math.random() * (i + 1));\n\t\t\t[array[i], array[j]] = [array[j], array[i]];\n\t\t}\n\t\treturn array;\n\t}\n\n\t\n\t\n\t\/\/this randomizes them into an order vector if they haven't been assigned yet\n\t\n\t\/\/ Check if randOrder embedded data field exists\n\tlet randOrder = Qualtrics.SurveyEngine.getEmbeddedData('randOrder');\n\tlet conditionNum = Qualtrics.SurveyEngine.getEmbeddedData('conditionNum');\t\n\tif (randOrder) {\n\t\t\/\/ If it exists, parse the string back to an array\n\t\trandOrder = JSON.parse(randOrder);\n\t\tconditionNum = JSON.parse(conditionNum);\n\t} else {\t\n\t\t\/\/ If it doesn't exist, generate the array and then store its stringified version in Qualtrics\n\t\t\t\n\t\t\/\/ Step 1: Generate randOrder array\n\t\tlet numbers = [];\n\t\tfor (let i = 1; i <= 40; i++) {\n    \t\tnumbers.push(i);\n\t\t}\n\t\tfisherYatesShuffle(numbers);\n\t\trandOrder = numbers.slice(0, 15); \/\/ First 15 entries\n\t    \n\t\t\n\t\t\/\/ Step 2: Generate conditionNum array\n\t\tlet conditionValues = [];\n\t\tfor (let i = 1; i <= 4; i++) {\n\t\t\tfor (let j = 0; j < 4; j++) {\n\t\t\t\tconditionValues.push(i);\n\t\t\t}\n\t\t}\n\t\tfisherYatesShuffle(conditionValues);\n\t\tconditionNum = conditionValues.slice(0, 15); \/\/ Randomly shuffled condition numbers\n\n\t\t\n\t\t\/\/ Step 3: Modify conditionNum and randOrder to get some repeats\n\n\t\t\/\/ Array of target values (1, 2, 3) to repeat\n\t\tlet targetValues = [1, 2, 3];\n\n\t\ttargetValues.forEach(value => {\n\t\t\tlet index = conditionNum.indexOf(value); \/\/ Find the first occurrence of the value\n\t\t\tconsole.log(\"index=\"+ index + \"for value\" + value);\n\t\t\tif (index !== -1) {\n\t\t\t\tlet newIndex = Math.min(index + 7, 14); \/\/ Ensure newIndex doesn't exceed 14\n\t\t\t\tconditionNum[newIndex] = value; \/\/ Set conditionNum at newIndex to the same value\n\t\t\t\trandOrder[newIndex] = randOrder[index]; \/\/ Set randOrder at newIndex to randOrder[index]\n\t\t\t}\n\t\t});\n\t\n\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('randOrder', JSON.stringify(randOrder));\n\t\tQualtrics.SurveyEngine.setEmbeddedData('conditionNum', JSON.stringify(conditionNum));\n\t\t\n\t}\n\tconsole.log(\"randOrder: \" + randOrder);\n\tconsole.log(\"conditionNum: \" + conditionNum);\n\t\n\t\n\t\/\/set listeners on sliders\n\tvar sliderMean = document.getElementById(\"meanSlider\");\n\tvar sliderVar = document.getElementById(\"varianceSlider\");\n\tsliderMean.oninput = function() {\n\t\tsurveyEngineInstance.enableNextButton();\n    \tthis.classList.add('show-thumb');  \/\/shows the slider button\n\t\tdocument.getElementById(\"instruction1\").style.display = 'none';  \/\/removes the \"click here\" text\n\t\tupdateMeanValue(this.value);\n  \t};\n\t\n\tsliderVar.oninput = function() {\n\t\tsurveyEngineInstance.enableNextButton();\n\t\tthis.classList.add('show-thumb'); \/\/shows the slider button\n\t\tdocument.getElementById(\"instruction2\").style.display = 'none'; \/\/removes the \"click here\" text\n    \tupdateVarianceValue(this.value);\n  \t};\n\t\n\t function erf(x) {\n        const a1 =  0.254829592;\n        const a2 = -0.284496736;\n        const a3 =  1.421413741;\n        const a4 = -1.453152027;\n        const a5 =  1.061405429;\n        const p  =  0.3275911;\n\n        const sign = (x < 0) ? -1 : 1;\n        x = Math.abs(x);\n\n        const t = 1.0 \/ (1.0 + p * x);\n        const y = (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t;\n\n        return sign * (1 - y * Math.exp(-x * x));\n    }\n\n\t\n     function cdf(x, mean, variance) {\n        return 0.5 * (1 + erf((x - mean) \/ Math.sqrt(2 * variance)));\n    }\n   \n\n\tfunction updateVarianceValue(value) {\n        \/\/document.getElementById('varianceValue').textContent = value;\n        computeProbabilities();\n        saveDataToQualtrics();\n    }\n\n\t\n    function updateMeanValue(value) {\n        document.getElementById('meanValue').textContent = value; \/\/display the mean for the person to see\n\t\tcomputeProbabilities();\n        adjustDotPosition();\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\/\/this just ensures everything is fine if the person changes their window size\n\t\n\t\/\/window.addEventListener('resize', function() {\n\t\/\/\tcomputeProbabilities();\n\t\/\/\tadjustDotPosition();\n\t\/\/});\n\n\n\tfunction adjustDotPosition() {\n\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\t\n\t\tconst slider = document.getElementById('meanSlider');\n\t\tconst dot = document.getElementById('dot');\n\t\tconst image = document.getElementById('exampleImage');\n\n\t\tconst sliderRange = 140-60;\n\t\tconst sliderPosition = (parseFloat(slider.value) - 60) \/ sliderRange;\n\t\t\n\t\tconst imageHeight = image.offsetHeight;\n\t\tconst imageWidth = image.offsetWidth-22;\n\t\tconst dotHeight = dot.offsetHeight;\n\n\t\t\/\/ Calculate the top position based on the image height and the slider's value.\n\t\tconst topPosition = 18+.78*(imageHeight * (1 - sliderPosition) - dotHeight \/ 2);\n\t\t\n\t\tdot.style.top = topPosition + \"px\";\n\t\tdot.style.left = imageWidth + \"px\"; \/\/ Ensure dot is on the right side of the image.\n\t}\n\n\n    function computeProbabilities() {\n        \n        const mean = parseFloat(document.getElementById('meanSlider').value);\n\t\t\/\/the formula below takes var -> the slider is in root(SD) so needs to be ^4\n        const variance = Math.pow(parseFloat(document.getElementById('varianceSlider').value),4);\n        const intervals = [[130,140],[120,130],[110,120],[100,110],[90,100],[80,90],[70,80],[60,70]];\n        const letters = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\"];\n\n\t\t\/\/this makes sure the heights line up with the picture \n\t\tconst imgHeight = document.getElementById('exampleImage').offsetHeight;\n        const spacerPercentage1 = 0.04;\n        const spacerHeight1 = imgHeight * spacerPercentage1;\n        const spacerPercentage2 = 0.22;\n        const spacerHeight2 = imgHeight * spacerPercentage2;\n        const letterRowHeight = (imgHeight - (spacerHeight1+spacerHeight2)) \/ 8;  \/\/ subtracting the two spacer rows and dividing by # rows\n\n        const tbody = document.getElementById('probTable');\t\t\n\t\ttbody.innerHTML = '';\n\t\ttbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n        intervals.forEach((interval, index) => {\n            const prob = (cdf(interval[1], mean, variance) - cdf(interval[0], mean, variance)) * 100;\n           \n            \/\/ Create a bar inside a container\n            const bar = '<div class=\"bar-container\"><div class=\"bar\" style=width:'+prob+'%;\"><\/div><\/div>';\n\n            const row ='<tr height='+letterRowHeight+'px><td>'+bar+'<\/td><td width=200>'+prob.toFixed(1)+'%<\/td><\/tr>';\n           \n            tbody.innerHTML += row;\n        });\n        tbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n    }\n\t\t\n\tfunction randomizeImage() {\n\t\tconst image = document.getElementById('exampleImage');\n\t\t\/\/ Now, you can use `randOrder` in the current page\n\t\tconst imageNumber = randOrder[window.loopCounter - 1];\n\t\tconst conditionNumber = conditionNum[window.loopCounter - 1];\n\t\timage.src = 'https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/images_4\/'+imageNumber+\"_\"+conditionNumber+'.jpeg';\n\t\tconsole.log(image.src);\n\t}\n\n\tfunction saveDataToQualtrics() {\n\t\tvar sliderMean = document.getElementById(\"meanSlider\").value;\n\t\t\/\/we are recording in SD -> the slider is in root(SD)\n\t\tvar sliderVar = Math.pow(parseFloat(document.getElementById('varianceSlider').value),2);\n\t\tconst condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\t\n\t\t\/\/so, this is hacky, but randomizing images but not the test images, so want to store test images as -2,-1...\n\t\tlet imageNumber=window.loopCounter;\n\t\tlet conditionNumber=window.loopCounter;\n\t\tif (window.loopCounter>0) {\n\t\t\timageNumber = randOrder[window.loopCounter - 1];\n\t\t\tconditionNumber = conditionNum[window.loopCounter - 1];\n\t\t}\n\t\tvar combinedData = window.currentData + window.loopCounter + \"~\" + condition+ \"~\" +imageNumber+\"_\"+ conditionNumber +'.jpeg~' + sliderMean + \"~\" + sliderVar + \"~\";\n\t\tQualtrics.SurveyEngine.setEmbeddedData('allSliderData', combinedData);\n\t\tconsole.log(\"allSliderData:\"+Qualtrics.SurveyEngine.getEmbeddedData('allSliderData'));\n    \n\t}\t\n\n\n\n\tfunction adjustRedArea(sliderId, areaId, correctValue, range) {\n\t\tconst slider = document.getElementById(sliderId);\n\t\tconst redArea = document.getElementById(areaId);\n\n\t\tconst totalWidth = slider.offsetWidth;\n\t\tconst minValue = parseFloat(slider.min);\n\t\tconst maxValue = parseFloat(slider.max);\n\n\t\tconst startValue = correctValue - range;\n\t\tconst endValue = correctValue + range;\n\t\t\n\t\tconst thumbWidth = 3; \/\/ Assuming 20px is your thumb width\n\n        const startPos = (startValue - minValue) \/ (maxValue - minValue) * 100 + thumbWidth;\n        const endPos = (endValue - minValue) \/ (maxValue - minValue) * 100 + thumbWidth;\n\n\t\tredArea.style.left = startPos+\"%\";\n\t\twidthPos=endPos-startPos;\n\t\tredArea.style.width = widthPos+\"%\";\n\t\tredArea.style.display = 'block'; \/\/ show the red area\n\t}\n\n\t\n\t\/\/for instructions, person wants to see the answers.\n\tif (document.getElementById('checkAnswer')) {\n\t\t\n\t\t\/\/so they don't get the next button until they press\n\t\t surveyEngineInstance.disableNextButton();\n\n\t   document.getElementById('checkAnswer').addEventListener('click', function() {\n\t\t    surveyEngineInstance.enableNextButton();\n\t\t   \n\t\t   \/\/ Example correct answer values. You can set these dynamically based on your data.\n\t\t  const correctMean = parseFloat(document.getElementById('correctMean').value);\n\t\t  const correctVariance = parseFloat(document.getElementById('correctVariance').value);\n\n\t\t  \/\/ Calculate positions for the red area -> the last variables have the size of the bonus area\n\t\t  adjustRedArea('meanSlider', 'meanRedArea', correctMean, 4);\n\t\t  adjustRedArea('varianceSlider', 'varianceRedArea', correctVariance, 0.25);\n\t\t\n\t\t  document.getElementById('predictionDesc').classList.remove('hidden');\n\t   });\n\t}\t\n\t\n\t\n\t\/\/for instructions: if there is a \"show prediction button\"\n\tif (document.getElementById(\"showPrediction\")) {\n\t\t surveyEngineInstance.disableNextButton();\n\t\tdocument.getElementById(\"showPrediction\").addEventListener(\"click\", function() {\n\t\t\t surveyEngineInstance.enableNextButton();\n\t\t\t\/\/ Show the table (with bars)\n\t\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\t\tdocument.getElementById('predictionDesc').classList.remove('hidden');\n\n\t\t\tcomputeProbabilities();\n\t\t\tadjustDotPosition();\t\t\n\t\t});\n\t};\n\n\n\t\n\t\/\/if we are in question with a slider bar\n\n\tif (document.getElementById('meanValue')) {\t\t\n\t\t surveyEngineInstance.disableNextButton();\n\t\t\/\/want to keep track of the loop number\n\t\twindow.loopCounter = parseInt(Qualtrics.SurveyEngine.getEmbeddedData('loopCounter'));\n\t\tconsole.log(\"-> retreived loop number:\"+loopCounter);\n\t\t\n\t\t\/\/update the loop number\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('loopCounter', loopCounter+1);\n\t\tconst loopCounterNew=window.loopCounter+1;\n\t\tconsole.log(\"-> updated loop number to \" +loopCounterNew);\n\t\t\n\t\t\/\/want to keep this stable so we can add to it:\n\t\twindow.currentData = Qualtrics.SurveyEngine.getEmbeddedData('allSliderData') || \"\";\n\t\t\n\t\t\/\/randomizing the image prefix\n\t\t\/\/const condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\t\/\/window.prefix = \n\t\t\/\/(condition === \"cl\" && window.loopCounter <= 6) ? \"cl\" :\n\t\t\/\/(condition === \"cl\") ? \"fn\" :\n\t\t\/\/(condition === \"cn\" && window.loopCounter <= 6) ? \"cn\" :\n\t\t\/\/(condition === \"cn\") ? \"fl\" :\n\t\t\/\/(condition === \"fl\" && window.loopCounter <= 6) ? \"fl\" :\n\t\t\/\/(condition === \"fl\") ? \"cn\" :\n\t\t\/\/(condition === \"fn\" && window.loopCounter <= 6) ? \"fn\" :\n\t\t\/\/(condition === \"fn\") ? \"cl\" : \n\t\t\"\"; \/\/ default value, in case no conditions are met\n\t\t\n\t\t\/\/if we are in the main area, need to change image\n\t\tif (this.questionId.includes(\"QID195\")) {\n\t\t\trandomizeImage();\n\t\t}\n\t\t\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\n});\n\nQualtrics.SurveyEngine.addOnUnload(function()\n{\n\t\/*Place your JavaScript here to run when the page is unloaded*\/\n\n});","DefaultChoices":false,"DataExportTag":"Instructions4","QuestionType":"DB","Selector":"TB","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Here is another example. Try your best to get the right answer - then click the button to see if...","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID203"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID176","SecondaryAttribute":"How likely is each trend?","TertiaryAttribute":null,"Payload":{"QuestionText":"How likely is each trend?","DataExportTag":"Q94","QuestionType":"MC","Selector":"SAVR","SubSelector":"TX","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"How likely is each trend?","Choices":{"1":{"Display":"Each possible trend is equally likely"},"2":{"Display":"Trends that are upwards are more likely"},"3":{"Display":"The flat trend is most likely"},"6":{"Display":"Downward trends are more likely"}},"ChoiceOrder":["1","2","3","6"],"Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"Language":[],"NextChoiceId":7,"NextAnswerId":1,"QuestionID":"QID176","DataVisibility":{"Private":false,"Hidden":false},"Randomization":{"Advanced":null,"TotalRandSubset":"","Type":"All"}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID52","SecondaryAttribute":"If you are interested in learning the results to this study, please visit the project's web site...","TertiaryAttribute":null,"Payload":{"QuestionText":"If you are interested in learning the results to this study, please visit the project's web site &lt;https:\/\/osf.io\/q86ev\/&gt;.&nbsp; We hope to have a writeup of results posted by January 1, 2025.&nbsp;&nbsp;","DefaultChoices":false,"DataExportTag":"Q28","QuestionID":"QID52","QuestionType":"DB","Selector":"TB","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"If you are interested in learning the results to this study, please visit the project's web site...","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"DataVisibility":{"Private":false,"Hidden":false}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID48","SecondaryAttribute":"If you want to participate, please click \"accept\" to proceed.","TertiaryAttribute":null,"Payload":{"QuestionText":"If you want to participate, please click \"accept\" to proceed.","DefaultChoices":false,"DataExportTag":"Q24","QuestionID":"QID48","QuestionType":"DB","Selector":"TB","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"If you want to participate, please click \"accept\" to proceed.","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionJS":"Qualtrics.SurveyEngine.addOnload(function()\n{\nvar newName = 'Accept';\nif ($('NextButton').nodeName == 'INPUT')\n{\n$('NextButton').setValue(newName);\n}\nelse if ($('NextButtonText').nodeName == 'SPAN')\n{\n$('NextButtonText').innerHTML = newName;\n}\nelse \/\/ next button is probably a button\n{\n$('NextButton').innerHTML = newName;\n}\n\n});"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID2","SecondaryAttribute":"In this survey, you will be playing a manager trying to predict sales at your 15 stores.\u00a0 Your go..","TertiaryAttribute":null,"Payload":{"QuestionText":"<span style=\"font-size:19px;\">In this survey, you will be playing a manager trying to predict sales at your 15 stores.&nbsp;<\/span><br>\n<img style=\"width: 290px; height: 200px;\" src=\"https:\/\/berkeley.qualtrics.com\/CP\/Graphic.php?IM=IM_czN2QvCeDXtI15Y\"><br>\n<span style=\"font-size:19px;\"><\/span><b>Your goal is to forecast sales<\/b> in order to prepare your stores with appropriate staff and inventory. To make forecasts, you will look at past sales data.<span style=\"font-size:19px;\"><\/span>","DefaultChoices":false,"DataExportTag":"Instructions","QuestionType":"DB","Selector":"TB","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"In this survey, you will be playing a manager trying to predict sales at your 15 stores.\u00a0 Your go...","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID2","DataVisibility":{"Private":false,"Hidden":false}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID39","SecondaryAttribute":"Please enter your Prolific ID here:","TertiaryAttribute":null,"Payload":{"QuestionText":"Please enter your Prolific ID here:","DefaultChoices":false,"DataExportTag":"Q39","QuestionID":"QID39","QuestionType":"TE","Selector":"SL","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Please enter your Prolific ID here:","Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"SearchSource":{"AllowFreeResponse":"false"}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID178","SecondaryAttribute":"Please predict this store's sales on the future day identified by the red vertical line:","TertiaryAttribute":null,"Payload":{"QuestionText":"Please predict this store's sales on the future day identified by the red vertical line:","DefaultChoices":false,"DataExportTag":"PointPrediction","QuestionID":"QID178","QuestionType":"TE","Selector":"SL","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Please predict this store's sales on the future day identified by the red vertical line:","Validation":{"Settings":{"ForceResponse":"ON","ForceResponseType":"ON","Type":"ContentType","MinChars":"1","ContentType":"ValidNumber","ValidDateType":"DateWithFormat","ValidPhoneType":"ValidUSPhone","ValidZipType":"ValidUSZip","ValidNumber":{"Min":"0","Max":"200","NumDecimals":"2"}}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"SearchSource":{"AllowFreeResponse":"false"},"DataVisibility":{"Private":false,"Hidden":false}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID172","SecondaryAttribute":"READ THE INSTRUCTIONS CAREFULLY. After you read the instructions there will be a quiz on the next...","TertiaryAttribute":null,"Payload":{"QuestionText":"<span style=\"font-size: 19px;\">READ THE INSTRUCTIONS CAREFULLY.<\/span><br>\n<span style=\"font-size:16px;\">After you read the instructions there will be a quiz on the next page.&nbsp;<br>\n<strong>If you answer all of the quiz questions correctly, you will earn a $1 bonus.<\/strong><br>\n<br>\nYou will not be able to go back and re-read the instructions.&nbsp;&nbsp;<br><\/span>","DefaultChoices":false,"DataExportTag":"Warning","QuestionID":"QID172","QuestionType":"DB","Selector":"TB","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"READ THE INSTRUCTIONS CAREFULLY. After you read the instructions there will be a quiz on the next...","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"DataVisibility":{"Private":false,"Hidden":false}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID190","SecondaryAttribute":"Sandbox \u2022 Best Guess: 100 Spread:","TertiaryAttribute":null,"Payload":{"QuestionText":"<style type=\"text\/css\">table td:nth-child(2) { \/* Column for percentages *\/\n    width: 50px;\n    text-align: left;\n}\n   \/* Styles for the sliders *\/\ninput[type=range] {\n    -webkit-appearance: none;\n    width: 100%;\n    background: transparent;\n    outline: none;\n}\n\ninput[type=range]::-webkit-slider-thumb {\n    -webkit-appearance: none;\n    appearance: none;\n    margin-top: -6px; \/* Adjust this to center the dot on the slider bar *\/\n    width: 20px;\n    height: 20px;\n    background: linear-gradient(145deg, #3b98db, #2c8ad4);\n    cursor: pointer;\n    border-radius: 50%;\n    box-shadow:  3px 3px 5px #b5b5b5, \n                -3px -3px 5px #ffffff;\n}\n\ninput[type=range]::-moz-range-thumb {\n    margin-top: -6px;\n    width: 20px;\n    height: 20px;\n    background: linear-gradient(145deg, #3b98db, #2c8ad4);\n    cursor: pointer;\n    border-radius: 50%;\n    box-shadow:  3px 3px 5px #b5b5b5, \n                -3px -3px 5px #ffffff;\n}\n\ninput[type=range]::-webkit-slider-runnable-track {\n    width: 20%;\n    height: 8px;\n    cursor: pointer;\n    background: #E0E0E0;\n    border-radius: 4px;\n    box-shadow:  inset 2px 2px 5px #b5b5b5, \n                inset -3px -3px 5px #ffffff;\n}\n\ninput[type=range]::-moz-range-track {\n    width: 20%;\n    height: 8px;\n    cursor: pointer;\n    background: #E0E0E0;\n    border-radius: 4px;\n    box-shadow:  inset 2px 2px 5px #b5b5b5, \n                inset -3px -3px 5px #ffffff;\n}\n\ninput[type=range]::-moz-focus-outer {\n    border: 0;\n}\n\n#slidersContainer {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 20px;  \/* Spacing between the sliders *\/\n    margin-top: 20px; \/* Spacing above the sliders. Adjust as needed. *\/\n}\n\n#slidersContainer > div {\n    width: 30%;  \/* Added this line to give each slider container 50% width *\/\n}\n\n\n      .container {\n            display: flex;\n            align-items: flex-start;\n        }\n\n        img {\n            max-width: 100%;\n        }\n\n        table {\n            margin-left: 10px;\n            padding: 0;\n        }\n\n        td {\n            width: 20px;\n            text-align: center;\n            padding: 0;\n        }\n        \/* Styling for the bars *\/\n        .bar-container {\n            width: 50px;  \/* Set a max width for the bars *\/\n            border: 1px solid #aaa;\n            padding:0px;\n        }\n\n        .bar {\n            background-color: #3498db;\n            height: 20px;\n        }\n\n#dot {\n    position: absolute;\n    background-color: gray;  \/* Add this to make it a gray dot *\/\n    width: 20px;   \/* Define the size of the dot *\/\n    height: 20px;\n    border-radius: 50%;   \/* Make the dot circular *\/\n    color: transparent;  \/* Hide the \"x\" text color *\/\n    text-align: center;\n    line-height: 20px; \/* Vertically center the \"x\", in case you switch back *\/\n}\n\n#imageContainer {\n    position: relative;\n    display: inline-flex;   \/* use flex to ensure it covers both the image and dot *\/\n    align-items: flex-start; \/* align content to the top *\/\n}\n\n<\/style>\nSandbox\n\n<div class=\"container\">\n <div id=\"imageContainer\" style=\"position: relative; display: inline-block;\">\n  <img id=\"exampleImage\" src=\"https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/problem6.png\" \/>\n  <span id=\"dot\">&#8226;<\/span>\n <\/div>\n <table>\n  <tbody id=\"probTable\">\n  <\/tbody>\n <\/table>\n<\/div>\n\n<div id=\"slidersContainer\">\n    <div>\n        Best Guess: <span id=\"meanValue\">100<\/span><br \/>\n        <input id=\"meanSlider\" max=\"140\" min=\"60\" step=\"1\" type=\"range\" value=\"100\" \/>\n    <\/div>\n    <div>\n        Spread:<br \/>\n        <input id=\"varianceSlider\" max=\"25\" min=\".1\" step=\"1\" type=\"range\" value=\".1\" \/>\n    <\/div>\n<\/div>","DefaultChoices":false,"DataExportTag":"Q23","QuestionType":"DB","Selector":"TB","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Sandbox \u2022 Best Guess: 100 Spread:","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID190","QuestionJS":"Qualtrics.SurveyEngine.addOnload(function()\n{\n\n\t\n\n});\n\nQualtrics.SurveyEngine.addOnReady(function()\n{\n\n\t\/\/<script src=\"https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/javascript.js\"><\/script>\t\n\t\/\/want to keep this stable so we can add to it:\n\twindow.currentData = Qualtrics.SurveyEngine.getEmbeddedData('allSliderData') || \"\";\n\tconsole.log(\"sliderData\"+Qualtrics.SurveyEngine.getEmbeddedData('allSliderData'));\n    \/\/want to keep track of the loop number\n\tconsole.log(\"sliderData\"+Qualtrics.SurveyEngine.getEmbeddedData('loopCounter'));\n\twindow.loopCounter = parseInt(Qualtrics.SurveyEngine.getEmbeddedData('loopCounter'))+1 || 1;\n\tQualtrics.SurveyEngine.setEmbeddedData('loopCounter', loopCounter);\n\t\n\t\n\tvar sliderMean = document.getElementById(\"meanSlider\");\n\tvar sliderVar = document.getElementById(\"varianceSlider\");\n\tsliderMean.oninput = function() {\n    \tupdateMeanValue(this.value);\n  \t};\n\t\n\tsliderVar.oninput = function() {\n    \tupdateVarianceValue(this.value);\n  \t};\n\t\n\t function erf(x) {\n        const a1 =  0.254829592;\n        const a2 = -0.284496736;\n        const a3 =  1.421413741;\n        const a4 = -1.453152027;\n        const a5 =  1.061405429;\n        const p  =  0.3275911;\n\n        const sign = (x < 0) ? -1 : 1;\n        x = Math.abs(x);\n\n        const t = 1.0 \/ (1.0 + p * x);\n        const y = (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t;\n\n        return sign * (1 - y * Math.exp(-x * x));\n    }\n\n\t\n     function cdf(x, mean, variance) {\n        return 0.5 * (1 + erf((x - mean) \/ Math.sqrt(2 * variance)));\n    }\n   \n\tfunction updateVarianceValue(value) {\n        \/\/document.getElementById('varianceValue').textContent = value;\n        computeProbabilities();\n        saveDataToQualtrics();\n    }\n\n\t\n    function updateMeanValue(value) {\n        document.getElementById('meanValue').textContent = value; \/\/display the mean for the person to see\n\t\tcomputeProbabilities();\n        adjustDotPosition();\n\t\tsaveDataToQualtrics();\n    }\n\t\n\tfunction saveDataToQualtrics() {\n\t\tvar sliderMean = document.getElementById(\"meanSlider\").value;\n\t\tvar sliderVar = document.getElementById(\"varianceSlider\").value;\n\t    var combinedData = window.currentData + window.loopCounter + \"~\" + sliderMean + \"~\" + sliderVar + \"~\";\n\t\tconsole.log(combinedData);\n\t\tQualtrics.SurveyEngine.setEmbeddedData('allSliderData', combinedData);\n\t\tconsole.log(\"Added\"+Qualtrics.SurveyEngine.getEmbeddedData('allSliderData'));\n    \n\t}\n\t\n\n\t\/\/this just ensures everything is fine if the person changes their window size\n\t\n\t\/\/window.addEventListener('resize', function() {\n\t\/\/\tcomputeProbabilities();\n\t\/\/\tadjustDotPosition();\n\t\/\/});\n\n\t\n\tfunction adjustDotPosition() {\n\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\t\n\t\tconst slider = document.getElementById('meanSlider');\n\t\tconst dot = document.getElementById('dot');\n\t\tconst image = document.getElementById('exampleImage');\n\n\t\tconst sliderRange = 140-60;\n\t\tconst sliderPosition = (parseFloat(slider.value) - 60) \/ sliderRange;\n\t\t\n\t\tconst imageHeight = image.offsetHeight;\n\t\tconst imageWidth = image.offsetWidth-22;\n\t\tconst dotHeight = dot.offsetHeight;\n\n\t\t\/\/ Calculate the top position based on the image height and the slider's value.\n\t\tconst topPosition = 18+.78*(imageHeight * (1 - sliderPosition) - dotHeight \/ 2);\n\t\t\n\t\tdot.style.top = topPosition + \"px\";\n\t\tdot.style.left = imageWidth + \"px\"; \/\/ Ensure dot is on the right side of the image.\n\t}\n\n\n\n\n    function computeProbabilities() {\n        \n        const mean = parseFloat(document.getElementById('meanSlider').value);\n        const variance = Math.pow(parseFloat(document.getElementById('varianceSlider').value),2);\n        const intervals = [[130,140],[120,130],[110,120],[100,110],[90,100],[80,90],[70,80],[60,70]];\n        const letters = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\"];\n\n\t\t\/\/this makes sure the heights line up with the picture \n\t\tconst imgHeight = document.getElementById('exampleImage').offsetHeight;\n        const spacerPercentage1 = 0.04;\n        const spacerHeight1 = imgHeight * spacerPercentage1;\n        const spacerPercentage2 = 0.19;\n        const spacerHeight2 = imgHeight * spacerPercentage2;\n        const letterRowHeight = (imgHeight - (spacerHeight1+spacerHeight2)) \/ 8;  \/\/ subtracting the two spacer rows and dividing by # rows\n\n        const tbody = document.getElementById('probTable');\t\t\n\t\ttbody.innerHTML = '';\n\t\ttbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n        intervals.forEach((interval, index) => {\n            const prob = (cdf(interval[1], mean, variance) - cdf(interval[0], mean, variance)) * 100;\n           \n            \/\/ Create a bar inside a container\n            const bar = '<div class=\"bar-container\"><div class=\"bar\" style=width:'+prob+'%;\"><\/div><\/div>';\n\n            const row ='<tr height='+letterRowHeight+'px><td>'+bar+'<\/td><td width=200>'+prob.toFixed(1)+'%<\/td><\/tr>';\n           \n            tbody.innerHTML += row;\n        });\n        tbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n    }\n\t\n\tif (document.getElementById(\"showPrediction\")) {\n\t\tdocument.getElementById(\"showPrediction\").addEventListener(\"click\", function() {\n\t\t\t\/\/ Show the table (with bars)\n\t\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\t\tdocument.getElementById('predictionDesc').classList.remove('hidden');\n\n\t\t\tcomputeProbabilities();\n\t\t\tadjustDotPosition();\t\t\n\t\t\t\/\/ If you want to also show the sliders, uncomment the line below\n\t\t\t\/\/ document.getElementById(\"slidersContainer\").style.display = \"block\";\n\t\t});\n\t};\n\t\n    \n\t\/\/ Initial table fill\n    \/\/computeProbabilities();\n\t\n\n});\n\nQualtrics.SurveyEngine.addOnUnload(function()\n{\n\t\/*Place your JavaScript here to run when the page is unloaded*\/\n\n});","DataVisibility":{"Private":false,"Hidden":false}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID189","SecondaryAttribute":"Select Mean and Variance Best Guess: 0 Spread: 0.1","TertiaryAttribute":null,"Payload":{"QuestionText":"<title>Normal Distribution Probabilities<\/title>\n    \n\n\n\n<h2>Select Mean and Variance<\/h2>\n\n<div>\n    Best Guess: <span id=\"meanValue\">0<\/span><br>\n    <input value=\"0\" step=\"0.1\" max=\"10\" min=\"-10\" id=\"meanSlider\" type=\"range\">\n<\/div>\n\n<div>\n    Spread: <span id=\"varianceValue\">0.1<\/span><br>\n    <input value=\"0.1\" step=\"0.1\" max=\"5\" min=\"0.1\" id=\"varianceSlider\" type=\"range\">\n<\/div>\n\n\n<table>\n    <tbody><\/tbody>\n<\/table>","DefaultChoices":false,"DataExportTag":"Q22","QuestionType":"Slider","Selector":"HSLIDER","Configuration":{"QuestionDescriptionOption":"UseText","CSSliderMin":0,"CSSliderMax":100,"GridLines":10,"SnapToGrid":false,"NumDecimals":"0","ShowValue":true,"CustomStart":false,"NotApplicable":false,"MobileFirst":true},"QuestionDescription":"Select Mean and Variance Best Guess: 0 Spread: 0.1","Choices":{"1":{"Display":"Click to write Choice 1"},"2":{"Display":"Click to write Choice 2"},"3":{"Display":"Click to write Choice 3"}},"ChoiceOrder":["1","2","3"],"Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"Labels":[],"QuestionID":"QID189"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID192","SecondaryAttribute":"Sometimes, the problem will be harder because there is more variability. For example, consider th...","TertiaryAttribute":null,"Payload":{"QuestionText":"Sometimes, the problem will be harder because there is more variability. \n<br><br>\nFor example, consider the following graph:\n<div class=\"container\">\n <div style=\"position: relative; display: inline-block;\" id=\"imageContainer\">\n  <img src=\"https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/train2.jpeg\" id=\"exampleImage\">\n  <span class=\"hidden\" id=\"dot\">\u2022<\/span>\n <\/div>\n <table>\n  <tbody class=\"hidden\" id=\"probTable\">\n  <\/tbody>\n <\/table>\n<\/div>\n<div style=\"display: none;\" id=\"slidersContainer\">\n<input value=\"94\" type=\"hidden\" id=\"meanSlider\">\n<input value=\"3.75\" type=\"hidden\" id=\"varianceSlider\">  \n<\/div>\nHere, <b>sales are falling and there is a lot of variability day-to-day<\/b>. While the trend still tells you the level of most likely sales on the chosen day, there is a higher chance that day-to-day sales might be higher or lower. Think about how likely you think sales will end in each bin.\n<br><br>\n<button id=\"showPrediction\">Click here to see the right prediction<\/button>\n<br>\n<span class=\"hidden\" id=\"predictionDesc\">The best guess here is still where the trend line hits the vertical line. However, because sales vary around the trend line, there is a decent chance that sales will be off the trend line. In this case, there is only about a 30% chance that sales end in most-likely bin.<\/span>","QuestionJS":"Qualtrics.SurveyEngine.addOnload(function()\n{\n\n\t\n\n});\n\nQualtrics.SurveyEngine.addOnReady(function()\n{\n\t\n\n\tvar surveyEngineInstance = this; \/\/ Store the context for use later\n\t\n\tconsole.log(this.questionId);\n\t\n\t\n\t\n\t\/\/ Function to generate a random permutation of numbers using the Fisher-Yates algorithm\n\tfunction fisherYatesShuffle(array) {\n\t\tfor (let i = array.length - 1; i > 0; i--) {\n\t\t\tconst j = Math.floor(Math.random() * (i + 1));\n\t\t\t[array[i], array[j]] = [array[j], array[i]];\n\t\t}\n\t\treturn array;\n\t}\n\n\t\n\t\n\t\/\/this randomizes them into an order vector if they haven't been assigned yet\n\t\n\t\/\/ Check if randOrder embedded data field exists\n\tlet randOrder = Qualtrics.SurveyEngine.getEmbeddedData('randOrder');\n\tlet conditionNum = Qualtrics.SurveyEngine.getEmbeddedData('conditionNum');\t\n\tif (randOrder) {\n\t\t\/\/ If it exists, parse the string back to an array\n\t\trandOrder = JSON.parse(randOrder);\n\t\tconditionNum = JSON.parse(conditionNum);\n\t} else {\t\n\t\t\/\/ If it doesn't exist, generate the array and then store its stringified version in Qualtrics\n\t\t\t\n\t\t\/\/ Step 1: Generate randOrder array\n\t\tlet numbers = [];\n\t\tfor (let i = 1; i <= 40; i++) {\n    \t\tnumbers.push(i);\n\t\t}\n\t\tfisherYatesShuffle(numbers);\n\t\trandOrder = numbers.slice(0, 15); \/\/ First 15 entries\n\t    \n\t\t\n\t\t\/\/ Step 2: Generate conditionNum array\n\t\tlet conditionValues = [];\n\t\tfor (let i = 1; i <= 4; i++) {\n\t\t\tfor (let j = 0; j < 4; j++) {\n\t\t\t\tconditionValues.push(i);\n\t\t\t}\n\t\t}\n\t\tfisherYatesShuffle(conditionValues);\n\t\tconditionNum = conditionValues.slice(0, 15); \/\/ Randomly shuffled condition numbers\n\n\t\t\n\t\t\/\/ Step 3: Modify conditionNum and randOrder to get some repeats\n\n\t\t\/\/ Array of target values (1, 2, 3) to repeat\n\t\tlet targetValues = [1, 2, 3];\n\n\t\ttargetValues.forEach(value => {\n\t\t\tlet index = conditionNum.indexOf(value); \/\/ Find the first occurrence of the value\n\t\t\tconsole.log(\"index=\"+ index + \"for value\" + value);\n\t\t\tif (index !== -1) {\n\t\t\t\tlet newIndex = Math.min(index + 7, 14); \/\/ Ensure newIndex doesn't exceed 14\n\t\t\t\tconditionNum[newIndex] = value; \/\/ Set conditionNum at newIndex to the same value\n\t\t\t\trandOrder[newIndex] = randOrder[index]; \/\/ Set randOrder at newIndex to randOrder[index]\n\t\t\t}\n\t\t});\n\t\n\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('randOrder', JSON.stringify(randOrder));\n\t\tQualtrics.SurveyEngine.setEmbeddedData('conditionNum', JSON.stringify(conditionNum));\n\t\t\n\t}\n\tconsole.log(\"randOrder: \" + randOrder);\n\tconsole.log(\"conditionNum: \" + conditionNum);\n\t\n\t\n\t\/\/set listeners on sliders\n\tvar sliderMean = document.getElementById(\"meanSlider\");\n\tvar sliderVar = document.getElementById(\"varianceSlider\");\n\tsliderMean.oninput = function() {\n\t\tsurveyEngineInstance.enableNextButton();\n    \tthis.classList.add('show-thumb');  \/\/shows the slider button\n\t\tdocument.getElementById(\"instruction1\").style.display = 'none';  \/\/removes the \"click here\" text\n\t\tupdateMeanValue(this.value);\n  \t};\n\t\n\tsliderVar.oninput = function() {\n\t\tsurveyEngineInstance.enableNextButton();\n\t\tthis.classList.add('show-thumb'); \/\/shows the slider button\n\t\tdocument.getElementById(\"instruction2\").style.display = 'none'; \/\/removes the \"click here\" text\n    \tupdateVarianceValue(this.value);\n  \t};\n\t\n\t function erf(x) {\n        const a1 =  0.254829592;\n        const a2 = -0.284496736;\n        const a3 =  1.421413741;\n        const a4 = -1.453152027;\n        const a5 =  1.061405429;\n        const p  =  0.3275911;\n\n        const sign = (x < 0) ? -1 : 1;\n        x = Math.abs(x);\n\n        const t = 1.0 \/ (1.0 + p * x);\n        const y = (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t;\n\n        return sign * (1 - y * Math.exp(-x * x));\n    }\n\n\t\n     function cdf(x, mean, variance) {\n        return 0.5 * (1 + erf((x - mean) \/ Math.sqrt(2 * variance)));\n    }\n   \n\n\tfunction updateVarianceValue(value) {\n        \/\/document.getElementById('varianceValue').textContent = value;\n        computeProbabilities();\n        saveDataToQualtrics();\n    }\n\n\t\n    function updateMeanValue(value) {\n        document.getElementById('meanValue').textContent = value; \/\/display the mean for the person to see\n\t\tcomputeProbabilities();\n        adjustDotPosition();\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\/\/this just ensures everything is fine if the person changes their window size\n\t\n\t\/\/window.addEventListener('resize', function() {\n\t\/\/\tcomputeProbabilities();\n\t\/\/\tadjustDotPosition();\n\t\/\/});\n\n\n\tfunction adjustDotPosition() {\n\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\t\n\t\tconst slider = document.getElementById('meanSlider');\n\t\tconst dot = document.getElementById('dot');\n\t\tconst image = document.getElementById('exampleImage');\n\n\t\tconst sliderRange = 140-60;\n\t\tconst sliderPosition = (parseFloat(slider.value) - 60) \/ sliderRange;\n\t\t\n\t\tconst imageHeight = image.offsetHeight;\n\t\tconst imageWidth = image.offsetWidth-22;\n\t\tconst dotHeight = dot.offsetHeight;\n\n\t\t\/\/ Calculate the top position based on the image height and the slider's value.\n\t\tconst topPosition = 18+.78*(imageHeight * (1 - sliderPosition) - dotHeight \/ 2);\n\t\t\n\t\tdot.style.top = topPosition + \"px\";\n\t\tdot.style.left = imageWidth + \"px\"; \/\/ Ensure dot is on the right side of the image.\n\t}\n\n\n    function computeProbabilities() {\n        \n        const mean = parseFloat(document.getElementById('meanSlider').value);\n\t\t\/\/the formula below takes var -> the slider is in root(SD) so needs to be ^4\n        const variance = Math.pow(parseFloat(document.getElementById('varianceSlider').value),4);\n        const intervals = [[130,140],[120,130],[110,120],[100,110],[90,100],[80,90],[70,80],[60,70]];\n        const letters = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\"];\n\n\t\t\/\/this makes sure the heights line up with the picture \n\t\tconst imgHeight = document.getElementById('exampleImage').offsetHeight;\n        const spacerPercentage1 = 0.04;\n        const spacerHeight1 = imgHeight * spacerPercentage1;\n        const spacerPercentage2 = 0.22;\n        const spacerHeight2 = imgHeight * spacerPercentage2;\n        const letterRowHeight = (imgHeight - (spacerHeight1+spacerHeight2)) \/ 8;  \/\/ subtracting the two spacer rows and dividing by # rows\n\n        const tbody = document.getElementById('probTable');\t\t\n\t\ttbody.innerHTML = '';\n\t\ttbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n        intervals.forEach((interval, index) => {\n            const prob = (cdf(interval[1], mean, variance) - cdf(interval[0], mean, variance)) * 100;\n           \n            \/\/ Create a bar inside a container\n            const bar = '<div class=\"bar-container\"><div class=\"bar\" style=width:'+prob+'%;\"><\/div><\/div>';\n\n            const row ='<tr height='+letterRowHeight+'px><td>'+bar+'<\/td><td width=200>'+prob.toFixed(1)+'%<\/td><\/tr>';\n           \n            tbody.innerHTML += row;\n        });\n        tbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n    }\n\t\t\n\tfunction randomizeImage() {\n\t\tconst image = document.getElementById('exampleImage');\n\t\t\/\/ Now, you can use `randOrder` in the current page\n\t\tconst imageNumber = randOrder[window.loopCounter - 1];\n\t\tconst conditionNumber = conditionNum[window.loopCounter - 1];\n\t\timage.src = 'https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/images_4\/'+imageNumber+\"_\"+conditionNumber+'.jpeg';\n\t\tconsole.log(image.src);\n\t}\n\n\tfunction saveDataToQualtrics() {\n\t\tvar sliderMean = document.getElementById(\"meanSlider\").value;\n\t\t\/\/we are recording in SD -> the slider is in root(SD)\n\t\tvar sliderVar = Math.pow(parseFloat(document.getElementById('varianceSlider').value),2);\n\t\tconst condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\t\n\t\t\/\/so, this is hacky, but randomizing images but not the test images, so want to store test images as -2,-1...\n\t\tlet imageNumber=window.loopCounter;\n\t\tlet conditionNumber=window.loopCounter;\n\t\tif (window.loopCounter>0) {\n\t\t\timageNumber = randOrder[window.loopCounter - 1];\n\t\t\tconditionNumber = conditionNum[window.loopCounter - 1];\n\t\t}\n\t\tvar combinedData = window.currentData + window.loopCounter + \"~\" + condition+ \"~\" +imageNumber+\"_\"+ conditionNumber +'.jpeg~' + sliderMean + \"~\" + sliderVar + \"~\";\n\t\tQualtrics.SurveyEngine.setEmbeddedData('allSliderData', combinedData);\n\t\tconsole.log(\"allSliderData:\"+Qualtrics.SurveyEngine.getEmbeddedData('allSliderData'));\n    \n\t}\t\n\n\n\n\tfunction adjustRedArea(sliderId, areaId, correctValue, range) {\n\t\tconst slider = document.getElementById(sliderId);\n\t\tconst redArea = document.getElementById(areaId);\n\n\t\tconst totalWidth = slider.offsetWidth;\n\t\tconst minValue = parseFloat(slider.min);\n\t\tconst maxValue = parseFloat(slider.max);\n\n\t\tconst startValue = correctValue - range;\n\t\tconst endValue = correctValue + range;\n\t\t\n\t\tconst thumbWidth = 3; \/\/ Assuming 20px is your thumb width\n\n        const startPos = (startValue - minValue) \/ (maxValue - minValue) * 100 + thumbWidth;\n        const endPos = (endValue - minValue) \/ (maxValue - minValue) * 100 + thumbWidth;\n\n\t\tredArea.style.left = startPos+\"%\";\n\t\twidthPos=endPos-startPos;\n\t\tredArea.style.width = widthPos+\"%\";\n\t\tredArea.style.display = 'block'; \/\/ show the red area\n\t}\n\n\t\n\t\/\/for instructions, person wants to see the answers.\n\tif (document.getElementById('checkAnswer')) {\n\t\t\n\t\t\/\/so they don't get the next button until they press\n\t\t surveyEngineInstance.disableNextButton();\n\n\t   document.getElementById('checkAnswer').addEventListener('click', function() {\n\t\t    surveyEngineInstance.enableNextButton();\n\t\t   \n\t\t   \/\/ Example correct answer values. You can set these dynamically based on your data.\n\t\t  const correctMean = parseFloat(document.getElementById('correctMean').value);\n\t\t  const correctVariance = parseFloat(document.getElementById('correctVariance').value);\n\n\t\t  \/\/ Calculate positions for the red area -> the last variables have the size of the bonus area\n\t\t  adjustRedArea('meanSlider', 'meanRedArea', correctMean, 4);\n\t\t  adjustRedArea('varianceSlider', 'varianceRedArea', correctVariance, 0.25);\n\t\t\n\t\t  document.getElementById('predictionDesc').classList.remove('hidden');\n\t   });\n\t}\t\n\t\n\t\n\t\/\/for instructions: if there is a \"show prediction button\"\n\tif (document.getElementById(\"showPrediction\")) {\n\t\t surveyEngineInstance.disableNextButton();\n\t\tdocument.getElementById(\"showPrediction\").addEventListener(\"click\", function() {\n\t\t\t surveyEngineInstance.enableNextButton();\n\t\t\t\/\/ Show the table (with bars)\n\t\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\t\tdocument.getElementById('predictionDesc').classList.remove('hidden');\n\n\t\t\tcomputeProbabilities();\n\t\t\tadjustDotPosition();\t\t\n\t\t});\n\t};\n\n\n\t\n\t\/\/if we are in question with a slider bar\n\n\tif (document.getElementById('meanValue')) {\t\t\n\t\t surveyEngineInstance.disableNextButton();\n\t\t\/\/want to keep track of the loop number\n\t\twindow.loopCounter = parseInt(Qualtrics.SurveyEngine.getEmbeddedData('loopCounter'));\n\t\tconsole.log(\"-> retreived loop number:\"+loopCounter);\n\t\t\n\t\t\/\/update the loop number\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('loopCounter', loopCounter+1);\n\t\tconst loopCounterNew=window.loopCounter+1;\n\t\tconsole.log(\"-> updated loop number to \" +loopCounterNew);\n\t\t\n\t\t\/\/want to keep this stable so we can add to it:\n\t\twindow.currentData = Qualtrics.SurveyEngine.getEmbeddedData('allSliderData') || \"\";\n\t\t\n\t\t\/\/randomizing the image prefix\n\t\t\/\/const condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\t\/\/window.prefix = \n\t\t\/\/(condition === \"cl\" && window.loopCounter <= 6) ? \"cl\" :\n\t\t\/\/(condition === \"cl\") ? \"fn\" :\n\t\t\/\/(condition === \"cn\" && window.loopCounter <= 6) ? \"cn\" :\n\t\t\/\/(condition === \"cn\") ? \"fl\" :\n\t\t\/\/(condition === \"fl\" && window.loopCounter <= 6) ? \"fl\" :\n\t\t\/\/(condition === \"fl\") ? \"cn\" :\n\t\t\/\/(condition === \"fn\" && window.loopCounter <= 6) ? \"fn\" :\n\t\t\/\/(condition === \"fn\") ? \"cl\" : \n\t\t\"\"; \/\/ default value, in case no conditions are met\n\t\t\n\t\t\/\/if we are in the main area, need to change image\n\t\tif (this.questionId.includes(\"QID195\")) {\n\t\t\trandomizeImage();\n\t\t}\n\t\t\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\n});\n\nQualtrics.SurveyEngine.addOnUnload(function()\n{\n\t\/*Place your JavaScript here to run when the page is unloaded*\/\n\n});","DefaultChoices":false,"DataExportTag":"Instructions2","QuestionType":"DB","Selector":"TB","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Sometimes, the problem will be harder because there is more variability. For example, consider th...","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID192"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID202","SecondaryAttribute":"Sometimes, there will be a very large about of variability in sales. In this case, while the aver...","TertiaryAttribute":null,"Payload":{"QuestionText":"Sometimes, there will be a very large about of variability in sales. In this case, while the average number of sales is clear, the actual sales varies a lot from day to day.<br><br>\nFor example, consider the following graph:\n<div class=\"container\">\n <div id=\"imageContainer\" style=\"position: relative; display: inline-block;\">\n  <img id=\"exampleImage\" src=\"https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/train2.jpeg\">\n  <span id=\"dot\" class=\"hidden\">\u2022<\/span>\n <\/div>\n <table>\n  <tbody id=\"probTable\" class=\"hidden\">\n  <\/tbody>\n <\/table>\n<\/div>\n<div id=\"slidersContainer\" style=\"display: none;\">\n<input id=\"meanSlider\" type=\"hidden\" value=\"95\">\n<input id=\"varianceSlider\" type=\"hidden\" value=\"2.73\">  \n<\/div>\nHere, <b>sales are falling and there is a lot of variability day-to-day<\/b>. While the trend still tells you the level of most likely sales on the chosen day, there is a higher chance that day-to-day sales might be higher or lower. Think about how likely you think sales will end in each bin.\n<br><br>\n<button id=\"showPrediction\">Click here to see the right prediction<\/button>\n<br>\n<span id=\"predictionDesc\" class=\"hidden\">Because sales vary around the trend line, there is a decent chance that sales will be off the trend line. In this case, there is only about a 50% chance that sales end in most-likely bin.<\/span>","QuestionJS":"Qualtrics.SurveyEngine.addOnload(function()\n{\n\n\t\n\n});\n\nQualtrics.SurveyEngine.addOnReady(function()\n{\n\t\n\n\t\n\t\/\/console.log(this.questionId);\n\t\n\t\/\/set listeners on sliders\n\tvar sliderMean = document.getElementById(\"meanSlider\");\n\tvar sliderVar = document.getElementById(\"varianceSlider\");\n\tsliderMean.oninput = function() {\n    \tupdateMeanValue(this.value);\n  \t};\n\t\n\tsliderVar.oninput = function() {\n    \tupdateVarianceValue(this.value);\n  \t};\n\t\n\t function erf(x) {\n        const a1 =  0.254829592;\n        const a2 = -0.284496736;\n        const a3 =  1.421413741;\n        const a4 = -1.453152027;\n        const a5 =  1.061405429;\n        const p  =  0.3275911;\n\n        const sign = (x < 0) ? -1 : 1;\n        x = Math.abs(x);\n\n        const t = 1.0 \/ (1.0 + p * x);\n        const y = (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t;\n\n        return sign * (1 - y * Math.exp(-x * x));\n    }\n\n\t\n     function cdf(x, mean, variance) {\n        return 0.5 * (1 + erf((x - mean) \/ Math.sqrt(2 * variance)));\n    }\n   \n\tfunction updateVarianceValue(value) {\n        \/\/document.getElementById('varianceValue').textContent = value;\n        computeProbabilities();\n        saveDataToQualtrics();\n    }\n\n\t\n    function updateMeanValue(value) {\n        document.getElementById('meanValue').textContent = value; \/\/display the mean for the person to see\n\t\tcomputeProbabilities();\n        adjustDotPosition();\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\/\/this just ensures everything is fine if the person changes their window size\n\t\n\t\/\/window.addEventListener('resize', function() {\n\t\/\/\tcomputeProbabilities();\n\t\/\/\tadjustDotPosition();\n\t\/\/});\n\n\n\tfunction adjustDotPosition() {\n\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\t\n\t\tconst slider = document.getElementById('meanSlider');\n\t\tconst dot = document.getElementById('dot');\n\t\tconst image = document.getElementById('exampleImage');\n\n\t\tconst sliderRange = 140-60;\n\t\tconst sliderPosition = (parseFloat(slider.value) - 60) \/ sliderRange;\n\t\t\n\t\tconst imageHeight = image.offsetHeight;\n\t\tconst imageWidth = image.offsetWidth-22;\n\t\tconst dotHeight = dot.offsetHeight;\n\n\t\t\/\/ Calculate the top position based on the image height and the slider's value.\n\t\tconst topPosition = 18+.78*(imageHeight * (1 - sliderPosition) - dotHeight \/ 2);\n\t\t\n\t\tdot.style.top = topPosition + \"px\";\n\t\tdot.style.left = imageWidth + \"px\"; \/\/ Ensure dot is on the right side of the image.\n\t}\n\n\n    function computeProbabilities() {\n        \n        const mean = parseFloat(document.getElementById('meanSlider').value);\n\t\t\/\/the formula below takes var -> the slider is in root(SD) so needs to be ^4\n        const variance = Math.pow(parseFloat(document.getElementById('varianceSlider').value),4);\n        const intervals = [[130,140],[120,130],[110,120],[100,110],[90,100],[80,90],[70,80],[60,70]];\n        const letters = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\"];\n\n\t\t\/\/this makes sure the heights line up with the picture \n\t\tconst imgHeight = document.getElementById('exampleImage').offsetHeight;\n        const spacerPercentage1 = 0.04;\n        const spacerHeight1 = imgHeight * spacerPercentage1;\n        const spacerPercentage2 = 0.22;\n        const spacerHeight2 = imgHeight * spacerPercentage2;\n        const letterRowHeight = (imgHeight - (spacerHeight1+spacerHeight2)) \/ 8;  \/\/ subtracting the two spacer rows and dividing by # rows\n\n        const tbody = document.getElementById('probTable');\t\t\n\t\ttbody.innerHTML = '';\n\t\ttbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n        intervals.forEach((interval, index) => {\n            const prob = (cdf(interval[1], mean, variance) - cdf(interval[0], mean, variance)) * 100;\n           \n            \/\/ Create a bar inside a container\n            const bar = '<div class=\"bar-container\"><div class=\"bar\" style=width:'+prob+'%;\"><\/div><\/div>';\n\n            const row ='<tr height='+letterRowHeight+'px><td>'+bar+'<\/td><td width=200>'+prob.toFixed(1)+'%<\/td><\/tr>';\n           \n            tbody.innerHTML += row;\n        });\n        tbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n    }\n\t\t\n\tfunction randomizeImage() {\n\t\tconst image = document.getElementById('exampleImage');\n\t\timage.src = 'https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/images\/'+window.loopCounter+window.prefix+'.jpeg';\n\t}\n\n\tfunction saveDataToQualtrics() {\n\t\tvar sliderMean = document.getElementById(\"meanSlider\").value;\n\t\t\/\/we are recording in SD -> the slider is in root(SD)\n\t\tvar sliderVar = Math.pow(parseFloat(document.getElementById('varianceSlider').value),2);\n\t\tconst condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\tvar combinedData = window.currentData + window.loopCounter + \"~\" + condition+ \"~\" +window.loopCounter+window.prefix +'.jpeg~' + sliderMean + \"~\" + sliderVar + \"~\";\n\t\tQualtrics.SurveyEngine.setEmbeddedData('allSliderData', combinedData);\n\t\tconsole.log(\"allSliderData:\"+Qualtrics.SurveyEngine.getEmbeddedData('allSliderData'));\n    \n\t}\t\n\t\n\t\/\/for instructions: if there is a \"show prediction button\"\n\tif (document.getElementById(\"showPrediction\")) {\n\t\tdocument.getElementById(\"showPrediction\").addEventListener(\"click\", function() {\n\t\t\t\/\/ Show the table (with bars)\n\t\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\t\tdocument.getElementById('predictionDesc').classList.remove('hidden');\n\n\t\t\tcomputeProbabilities();\n\t\t\tadjustDotPosition();\t\t\n\t\t});\n\t};\n\n\n\t\n\t\/\/if we are in question with a slider bar\n\tif (this.questionId.includes(\"QID193\") || this.questionId.includes(\"QID194\") || this.questionId.includes(\"QID195\") ) {\t\t\n\t\t\n\t\t\/\/want to keep track of the loop number\n\t\twindow.loopCounter = parseInt(Qualtrics.SurveyEngine.getEmbeddedData('loopCounter'));\n\t\t\/\/console.log(\"-> retreived loop number:\"+loopCounter);\n\t\t\n\t\t\/\/update the loop number\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('loopCounter', loopCounter+1);\n\t\tconst loopCounterNew=window.loopCounter+1;\n\t\t\/\/console.log(\"-> updated loop number to \" +loopCounterNew);\n\t\t\n\t\t\/\/want to keep this stable so we can add to it:\n\t\twindow.currentData = Qualtrics.SurveyEngine.getEmbeddedData('allSliderData') || \"\";\n\t\t\n\t\t\/\/randomizing the image prefix\n\t\tconst condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\twindow.prefix = \n\t\t(condition === \"cl\" && window.loopCounter <= 3) ? \"cl\" :\n\t\t(condition === \"cl\") ? \"fn\" :\n\t\t(condition === \"cn\" && window.loopCounter <= 3) ? \"cn\" :\n\t\t(condition === \"cn\") ? \"fl\" :\n\t\t(condition === \"fl\" && window.loopCounter <= 3) ? \"fl\" :\n\t\t(condition === \"fl\") ? \"cn\" :\n\t\t(condition === \"fn\" && window.loopCounter <= 3) ? \"fn\" :\n\t\t(condition === \"fn\") ? \"cl\" : \n\t\t\"\"; \/\/ default value, in case no conditions are met\n\t\t\n\t\t\/\/if we are in the main area, need to change image\n\t\tif (this.questionId.includes(\"QID195\")) {\n\t\t\trandomizeImage();\n\t\t}\n\t\t\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n});\n\nQualtrics.SurveyEngine.addOnUnload(function()\n{\n\t\/*Place your JavaScript here to run when the page is unloaded*\/\n\n});","DefaultChoices":false,"DataExportTag":"Q35","QuestionType":"DB","Selector":"TB","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Sometimes, there will be a very large about of variability in sales. In this case, while the aver...","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID202"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID194","SecondaryAttribute":"Sometimes, you won\u2019t be given the trend. Each trend line starts at 100 and is always a straight l.","TertiaryAttribute":null,"Payload":{"QuestionText":"Sometimes, you won\u2019t be given the trend. <b>Each trend line starts at 100 and is always a straight line,<\/b><b>&nbsp;but you won\u2019t know which trend was chosen.<\/b> \n<br><br>Although you won't be given the trend line, you can learn about what it is likely to be from the observed data points. \n<br><br>\n<b>You will be asked to make predictions about sales in the same way<\/b>. \n<br>Try it out here:\n\n<div class=\"container\">\n <div id=\"imageContainer\" style=\"position: relative; display: inline-block;\">\n<img id=\"exampleImage\" src=\"https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/train3.jpeg\">\n  <span class=\"hidden\" id=\"dot\">\u2022<\/span>\n <\/div>\n <table>\n  <tbody class=\"hidden\" id=\"probTable\">\n  <\/tbody>\n <\/table>\n<\/div>\n\n<input type=\"hidden\" id=\"correctMean\" value=\"104\">\n<input type=\"hidden\" id=\"correctVariance\" value=\"2.75\">\n\n\n\n<div id=\"slidersContainer\">\n    <div>\n        Best Guess: <span id=\"meanValue\">-<\/span><br>\n        <div class=\"slider-wrapper\">\n             <span id=\"instruction1\" class=\"slider-instruction\">Click here to choose<\/span>\n             <input value=\"100\" type=\"range\" step=\"1\" min=\"60\" max=\"140\" id=\"meanSlider\">\n             <div id=\"meanRedArea\" class=\"red-area\">\n                   <span class=\"exact-answer\">\u2022<\/span>\n             <\/div>\n       <\/div>   \n    <\/div>\n\n  \n    <div>\n        Uncertainty:<br>\n        <div class=\"slider-wrapper\">\n             <span id=\"instruction2\" class=\"slider-instruction\">Click here to choose<\/span>\n             <input value=\"1.1\" type=\"range\" step=\".01\" min=\"1\" max=\"5\" id=\"varianceSlider\">\n             <div id=\"varianceRedArea\" class=\"red-area\">\n                   <span class=\"exact-answer\">\u2022<\/span>\n             <\/div>\n       <\/div>         \n\n\n    <\/div>\n<\/div>\n\n<br>\n<button id=\"checkAnswer\">Click here to show the right answer on the sliders<\/button>\n<span id=\"predictionDesc\" class=\"hidden\">\n\n<br><br>The red dot shows you the right answer.\n<br><br>As before, the red dot shows you the right answer and the orange area shows how close you have to be to get the bonus.\n<br><br>\nMove the sliders to the right answer to make sure you know the right answer for this example.\n<\/span>","QuestionJS":"Qualtrics.SurveyEngine.addOnload(function()\n{\n\n\t\n\n});\n\nQualtrics.SurveyEngine.addOnReady(function()\n{\n\t\n\n\tvar surveyEngineInstance = this; \/\/ Store the context for use later\n\t\n\tconsole.log(this.questionId);\n\t\n\t\n\t\n\t\/\/ Function to generate a random permutation of numbers using the Fisher-Yates algorithm\n\tfunction fisherYatesShuffle(array) {\n\t\tfor (let i = array.length - 1; i > 0; i--) {\n\t\t\tconst j = Math.floor(Math.random() * (i + 1));\n\t\t\t[array[i], array[j]] = [array[j], array[i]];\n\t\t}\n\t\treturn array;\n\t}\n\n\t\n\t\n\t\/\/this randomizes them into an order vector if they haven't been assigned yet\n\t\n\t\/\/ Check if randOrder embedded data field exists\n\tlet randOrder = Qualtrics.SurveyEngine.getEmbeddedData('randOrder');\n\tlet conditionNum = Qualtrics.SurveyEngine.getEmbeddedData('conditionNum');\t\n\tif (randOrder) {\n\t\t\/\/ If it exists, parse the string back to an array\n\t\trandOrder = JSON.parse(randOrder);\n\t\tconditionNum = JSON.parse(conditionNum);\n\t} else {\t\n\t\t\/\/ If it doesn't exist, generate the array and then store its stringified version in Qualtrics\n\t\t\t\n\t\t\/\/ Step 1: Generate randOrder array\n\t\tlet numbers = [];\n\t\tfor (let i = 1; i <= 40; i++) {\n    \t\tnumbers.push(i);\n\t\t}\n\t\tfisherYatesShuffle(numbers);\n\t\trandOrder = numbers.slice(0, 15); \/\/ First 15 entries\n\t    \n\t\t\n\t\t\/\/ Step 2: Generate conditionNum array\n\t\tlet conditionValues = [];\n\t\tfor (let i = 1; i <= 4; i++) {\n\t\t\tfor (let j = 0; j < 4; j++) {\n\t\t\t\tconditionValues.push(i);\n\t\t\t}\n\t\t}\n\t\tfisherYatesShuffle(conditionValues);\n\t\tconditionNum = conditionValues.slice(0, 15); \/\/ Randomly shuffled condition numbers\n\n\t\t\n\t\t\/\/ Step 3: Modify conditionNum and randOrder to get some repeats\n\n\t\t\/\/ Array of target values (1, 2, 3) to repeat\n\t\tlet targetValues = [1, 2, 3];\n\n\t\ttargetValues.forEach(value => {\n\t\t\tlet index = conditionNum.indexOf(value); \/\/ Find the first occurrence of the value\n\t\t\tconsole.log(\"index=\"+ index + \"for value\" + value);\n\t\t\tif (index !== -1) {\n\t\t\t\tlet newIndex = Math.min(index + 7, 14); \/\/ Ensure newIndex doesn't exceed 14\n\t\t\t\tconditionNum[newIndex] = value; \/\/ Set conditionNum at newIndex to the same value\n\t\t\t\trandOrder[newIndex] = randOrder[index]; \/\/ Set randOrder at newIndex to randOrder[index]\n\t\t\t}\n\t\t});\n\t\n\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('randOrder', JSON.stringify(randOrder));\n\t\tQualtrics.SurveyEngine.setEmbeddedData('conditionNum', JSON.stringify(conditionNum));\n\t\t\n\t}\n\tconsole.log(\"randOrder: \" + randOrder);\n\tconsole.log(\"conditionNum: \" + conditionNum);\n\t\n\t\n\t\/\/set listeners on sliders\n\tvar sliderMean = document.getElementById(\"meanSlider\");\n\tvar sliderVar = document.getElementById(\"varianceSlider\");\n\tsliderMean.oninput = function() {\n\t\tsurveyEngineInstance.enableNextButton();\n    \tthis.classList.add('show-thumb');  \/\/shows the slider button\n\t\tdocument.getElementById(\"instruction1\").style.display = 'none';  \/\/removes the \"click here\" text\n\t\tupdateMeanValue(this.value);\n  \t};\n\t\n\tsliderVar.oninput = function() {\n\t\tsurveyEngineInstance.enableNextButton();\n\t\tthis.classList.add('show-thumb'); \/\/shows the slider button\n\t\tdocument.getElementById(\"instruction2\").style.display = 'none'; \/\/removes the \"click here\" text\n    \tupdateVarianceValue(this.value);\n  \t};\n\t\n\t function erf(x) {\n        const a1 =  0.254829592;\n        const a2 = -0.284496736;\n        const a3 =  1.421413741;\n        const a4 = -1.453152027;\n        const a5 =  1.061405429;\n        const p  =  0.3275911;\n\n        const sign = (x < 0) ? -1 : 1;\n        x = Math.abs(x);\n\n        const t = 1.0 \/ (1.0 + p * x);\n        const y = (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t;\n\n        return sign * (1 - y * Math.exp(-x * x));\n    }\n\n\t\n     function cdf(x, mean, variance) {\n        return 0.5 * (1 + erf((x - mean) \/ Math.sqrt(2 * variance)));\n    }\n   \n\n\tfunction updateVarianceValue(value) {\n        \/\/document.getElementById('varianceValue').textContent = value;\n        computeProbabilities();\n        saveDataToQualtrics();\n    }\n\n\t\n    function updateMeanValue(value) {\n        document.getElementById('meanValue').textContent = value; \/\/display the mean for the person to see\n\t\tcomputeProbabilities();\n        adjustDotPosition();\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\/\/this just ensures everything is fine if the person changes their window size\n\t\n\t\/\/window.addEventListener('resize', function() {\n\t\/\/\tcomputeProbabilities();\n\t\/\/\tadjustDotPosition();\n\t\/\/});\n\n\n\tfunction adjustDotPosition() {\n\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\t\n\t\tconst slider = document.getElementById('meanSlider');\n\t\tconst dot = document.getElementById('dot');\n\t\tconst image = document.getElementById('exampleImage');\n\n\t\tconst sliderRange = 140-60;\n\t\tconst sliderPosition = (parseFloat(slider.value) - 60) \/ sliderRange;\n\t\t\n\t\tconst imageHeight = image.offsetHeight;\n\t\tconst imageWidth = image.offsetWidth-22;\n\t\tconst dotHeight = dot.offsetHeight;\n\n\t\t\/\/ Calculate the top position based on the image height and the slider's value.\n\t\tconst topPosition = 18+.78*(imageHeight * (1 - sliderPosition) - dotHeight \/ 2);\n\t\t\n\t\tdot.style.top = topPosition + \"px\";\n\t\tdot.style.left = imageWidth + \"px\"; \/\/ Ensure dot is on the right side of the image.\n\t}\n\n\n    function computeProbabilities() {\n        \n        const mean = parseFloat(document.getElementById('meanSlider').value);\n\t\t\/\/the formula below takes var -> the slider is in root(SD) so needs to be ^4\n        const variance = Math.pow(parseFloat(document.getElementById('varianceSlider').value),4);\n        const intervals = [[130,140],[120,130],[110,120],[100,110],[90,100],[80,90],[70,80],[60,70]];\n        const letters = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\"];\n\n\t\t\/\/this makes sure the heights line up with the picture \n\t\tconst imgHeight = document.getElementById('exampleImage').offsetHeight;\n        const spacerPercentage1 = 0.04;\n        const spacerHeight1 = imgHeight * spacerPercentage1;\n        const spacerPercentage2 = 0.22;\n        const spacerHeight2 = imgHeight * spacerPercentage2;\n        const letterRowHeight = (imgHeight - (spacerHeight1+spacerHeight2)) \/ 8;  \/\/ subtracting the two spacer rows and dividing by # rows\n\n        const tbody = document.getElementById('probTable');\t\t\n\t\ttbody.innerHTML = '';\n\t\ttbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n        intervals.forEach((interval, index) => {\n            const prob = (cdf(interval[1], mean, variance) - cdf(interval[0], mean, variance)) * 100;\n           \n            \/\/ Create a bar inside a container\n            const bar = '<div class=\"bar-container\"><div class=\"bar\" style=width:'+prob+'%;\"><\/div><\/div>';\n\n            const row ='<tr height='+letterRowHeight+'px><td>'+bar+'<\/td><td width=200>'+prob.toFixed(1)+'%<\/td><\/tr>';\n           \n            tbody.innerHTML += row;\n        });\n        tbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n    }\n\t\t\n\tfunction randomizeImage() {\n\t\tconst image = document.getElementById('exampleImage');\n\t\t\/\/ Now, you can use `randOrder` in the current page\n\t\tconst imageNumber = randOrder[window.loopCounter - 1];\n\t\tconst conditionNumber = conditionNum[window.loopCounter - 1];\n\t\timage.src = 'https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/images_4\/'+imageNumber+\"_\"+conditionNumber+'.jpeg';\n\t\tconsole.log(image.src);\n\t}\n\n\tfunction saveDataToQualtrics() {\n\t\tvar sliderMean = document.getElementById(\"meanSlider\").value;\n\t\t\/\/we are recording in SD -> the slider is in root(SD)\n\t\tvar sliderVar = Math.pow(parseFloat(document.getElementById('varianceSlider').value),2);\n\t\tconst condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\t\n\t\t\/\/so, this is hacky, but randomizing images but not the test images, so want to store test images as -2,-1...\n\t\tlet imageNumber=window.loopCounter;\n\t\tlet conditionNumber=window.loopCounter;\n\t\tif (window.loopCounter>0) {\n\t\t\timageNumber = randOrder[window.loopCounter - 1];\n\t\t\tconditionNumber = conditionNum[window.loopCounter - 1];\n\t\t}\n\t\tvar combinedData = window.currentData + window.loopCounter + \"~\" + condition+ \"~\" +imageNumber+\"_\"+ conditionNumber +'.jpeg~' + sliderMean + \"~\" + sliderVar + \"~\";\n\t\tQualtrics.SurveyEngine.setEmbeddedData('allSliderData', combinedData);\n\t\tconsole.log(\"allSliderData:\"+Qualtrics.SurveyEngine.getEmbeddedData('allSliderData'));\n    \n\t}\t\n\n\n\n\tfunction adjustRedArea(sliderId, areaId, correctValue, range) {\n\t\tconst slider = document.getElementById(sliderId);\n\t\tconst redArea = document.getElementById(areaId);\n\n\t\tconst totalWidth = slider.offsetWidth;\n\t\tconst minValue = parseFloat(slider.min);\n\t\tconst maxValue = parseFloat(slider.max);\n\n\t\tconst startValue = correctValue - range;\n\t\tconst endValue = correctValue + range;\n\t\t\n\t\tconst thumbWidth = 3; \/\/ Assuming 20px is your thumb width\n\n        const startPos = (startValue - minValue) \/ (maxValue - minValue) * 100 + thumbWidth;\n        const endPos = (endValue - minValue) \/ (maxValue - minValue) * 100 + thumbWidth;\n\n\t\tredArea.style.left = startPos+\"%\";\n\t\twidthPos=endPos-startPos;\n\t\tredArea.style.width = widthPos+\"%\";\n\t\tredArea.style.display = 'block'; \/\/ show the red area\n\t}\n\n\t\n\t\/\/for instructions, person wants to see the answers.\n\tif (document.getElementById('checkAnswer')) {\n\t\t\n\t\t\/\/so they don't get the next button until they press\n\t\t surveyEngineInstance.disableNextButton();\n\n\t   document.getElementById('checkAnswer').addEventListener('click', function() {\n\t\t    surveyEngineInstance.enableNextButton();\n\t\t   \n\t\t   \/\/ Example correct answer values. You can set these dynamically based on your data.\n\t\t  const correctMean = parseFloat(document.getElementById('correctMean').value);\n\t\t  const correctVariance = parseFloat(document.getElementById('correctVariance').value);\n\n\t\t  \/\/ Calculate positions for the red area -> the last variables have the size of the bonus area\n\t\t  adjustRedArea('meanSlider', 'meanRedArea', correctMean, 4);\n\t\t  adjustRedArea('varianceSlider', 'varianceRedArea', correctVariance, 0.25);\n\t\t\n\t\t  document.getElementById('predictionDesc').classList.remove('hidden');\n\t   });\n\t}\t\n\t\n\t\n\t\/\/for instructions: if there is a \"show prediction button\"\n\tif (document.getElementById(\"showPrediction\")) {\n\t\t surveyEngineInstance.disableNextButton();\n\t\tdocument.getElementById(\"showPrediction\").addEventListener(\"click\", function() {\n\t\t\t surveyEngineInstance.enableNextButton();\n\t\t\t\/\/ Show the table (with bars)\n\t\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\t\tdocument.getElementById('predictionDesc').classList.remove('hidden');\n\n\t\t\tcomputeProbabilities();\n\t\t\tadjustDotPosition();\t\t\n\t\t});\n\t};\n\n\n\t\n\t\/\/if we are in question with a slider bar\n\n\tif (document.getElementById('meanValue')) {\t\t\n\t\t surveyEngineInstance.disableNextButton();\n\t\t\/\/want to keep track of the loop number\n\t\twindow.loopCounter = parseInt(Qualtrics.SurveyEngine.getEmbeddedData('loopCounter'));\n\t\tconsole.log(\"-> retreived loop number:\"+loopCounter);\n\t\t\n\t\t\/\/update the loop number\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('loopCounter', loopCounter+1);\n\t\tconst loopCounterNew=window.loopCounter+1;\n\t\tconsole.log(\"-> updated loop number to \" +loopCounterNew);\n\t\t\n\t\t\/\/want to keep this stable so we can add to it:\n\t\twindow.currentData = Qualtrics.SurveyEngine.getEmbeddedData('allSliderData') || \"\";\n\t\t\n\t\t\/\/randomizing the image prefix\n\t\t\/\/const condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\t\/\/window.prefix = \n\t\t\/\/(condition === \"cl\" && window.loopCounter <= 6) ? \"cl\" :\n\t\t\/\/(condition === \"cl\") ? \"fn\" :\n\t\t\/\/(condition === \"cn\" && window.loopCounter <= 6) ? \"cn\" :\n\t\t\/\/(condition === \"cn\") ? \"fl\" :\n\t\t\/\/(condition === \"fl\" && window.loopCounter <= 6) ? \"fl\" :\n\t\t\/\/(condition === \"fl\") ? \"cn\" :\n\t\t\/\/(condition === \"fn\" && window.loopCounter <= 6) ? \"fn\" :\n\t\t\/\/(condition === \"fn\") ? \"cl\" : \n\t\t\"\"; \/\/ default value, in case no conditions are met\n\t\t\n\t\t\/\/if we are in the main area, need to change image\n\t\tif (this.questionId.includes(\"QID195\")) {\n\t\t\trandomizeImage();\n\t\t}\n\t\t\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\n});\n\nQualtrics.SurveyEngine.addOnUnload(function()\n{\n\t\/*Place your JavaScript here to run when the page is unloaded*\/\n\n});","DefaultChoices":false,"DataExportTag":"Instructions4","QuestionType":"DB","Selector":"TB","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Sometimes, you won\u2019t be given the trend. Each trend line starts at 100 and is always a straight l...","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID194"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID167","SecondaryAttribute":"The figure below shows sales from one of your stores.\u00a0 Each dot represents one day's total sales...","TertiaryAttribute":null,"Payload":{"QuestionText":"<span style=\"font-size:19px;\">The figure below shows sales from one of your stores.&nbsp; Each dot represents one day's total sales.&nbsp; Your job is to predict sales several days after the last dot, as indicated by the red vertical line.&nbsp;<\/span><br>","QuestionJS":false,"DefaultChoices":false,"DataExportTag":"Explanation","QuestionID":"QID167","QuestionType":"DB","Selector":"TB","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"The figure below shows sales from one of your stores.\u00a0 Each dot represents one day's total sales....","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID161","SecondaryAttribute":"To the right of the red line, the range of sales is broken into 8 bins.\u00a0 How likely is it that th..","TertiaryAttribute":null,"Payload":{"QuestionText":"<div id=\"probabilityQuestionText\">To the right of the red line, the range of sales is broken into 8 bins.&nbsp;<\/div><div id=\"probabilityQuestionText\">How likely is it that the store's sales will land in each of the bins?<\/div>","DefaultChoices":false,"DataExportTag":"HistogramElicitation","QuestionID":"QID161","QuestionType":"CS","Selector":"HBAR","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText","CSSliderMin":0,"CSSliderMax":100,"GridLines":10,"NumDecimals":"0","ShowValue":true,"CustomStart":false},"QuestionDescription":"To the right of the red line, the range of sales is broken into 8 bins.\u00a0 How likely is it that th...","Choices":{"4":{"Display":"Bin A"},"5":{"Display":"Bin B"},"6":{"Display":"Bin C"},"7":{"Display":"Bin D"},"8":{"Display":"Bin E"},"9":{"Display":"Bin F"},"10":{"Display":"Bin G"},"11":{"Display":"Bin H"}},"ChoiceOrder":["4","5","6","7","8","9","10","11"],"Validation":{"Settings":{"Type":"ChoicesTotal","ChoiceTotal":"100"}},"GradingData":[],"Language":[],"NextChoiceId":14,"NextAnswerId":3,"Labels":{"1":{"Display":"Impossible"},"2":{"Display":"Absolutely certain"}},"ClarifyingSymbolType":"None"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID198","SecondaryAttribute":"What day are you predicting for?","TertiaryAttribute":null,"Payload":{"QuestionText":"What day are you predicting for?","DefaultChoices":false,"DataExportTag":"Q31","QuestionType":"MC","Selector":"SAVR","SubSelector":"TX","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"What day are you predicting for?","Choices":{"1":{"Display":"The day with the red line"},"2":{"Display":"Day 17"},"3":{"Display":"Day 10"},"4":{"Display":"Day 15"}},"ChoiceOrder":["1","2","3","4"],"Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":5,"NextAnswerId":1,"QuestionID":"QID198","DataVisibility":{"Private":false,"Hidden":false},"Randomization":{"Advanced":null,"TotalRandSubset":"","Type":"All"}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID199","SecondaryAttribute":"What is your goal in this study?","TertiaryAttribute":null,"Payload":{"QuestionText":"What is your goal in this study?","DefaultChoices":false,"DataExportTag":"Q32","QuestionType":"MC","Selector":"SAVR","SubSelector":"TX","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"What is your goal in this study?","Choices":{"1":{"Display":"Predict future sales from past data"},"2":{"Display":"Predict stock prices from past data"},"3":{"Display":"Predict test scores from past data"}},"ChoiceOrder":["1","2","3"],"Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID199","DataVisibility":{"Private":false,"Hidden":false},"Randomization":{"Advanced":null,"TotalRandSubset":"","Type":"All"}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID174","SecondaryAttribute":"What number do all of the trend lines start at?","TertiaryAttribute":null,"Payload":{"QuestionText":"What number do all of the trend lines start at?","DataExportTag":"Q92","QuestionType":"MC","Selector":"SAVR","SubSelector":"TX","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"What number do all of the trend lines start at?","Choices":{"1":{"Display":"100"},"2":{"Display":"90"},"3":{"Display":"80"},"4":{"Display":"110"},"5":{"Display":"120"}},"ChoiceOrder":["1","2","3","4","5"],"Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"Language":[],"NextChoiceId":7,"NextAnswerId":1,"QuestionID":"QID174","Randomization":{"Advanced":null,"TotalRandSubset":"","Type":"All"},"DataVisibility":{"Private":false,"Hidden":false}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID205","SecondaryAttribute":"When you are given the trend line, where should you place the \"best guess\" dot?","TertiaryAttribute":null,"Payload":{"QuestionText":"When you are given the trend line, where should you place the \"best guess\" dot?","DefaultChoices":false,"DataExportTag":"Q38","QuestionType":"MC","Selector":"SAVR","SubSelector":"TX","Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"When you are given the trend line, where should you place the \"best guess\" dot?","Choices":{"1":{"Display":"Exactly where the trend line hits the red vertical line"},"3":{"Display":"Above the trend line"},"4":{"Display":"Where the trendline starts"},"5":{"Display":"At 100"}},"ChoiceOrder":["1","3","4","5"],"Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":6,"NextAnswerId":1,"QuestionID":"QID205","DataVisibility":{"Private":false,"Hidden":false}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID206","SecondaryAttribute":"When you are given the trend line, where should you place the \"best guess\" dot?","TertiaryAttribute":null,"Payload":{"QuestionText":"When you are given the trend line, where should you place the \"best guess\" dot?","DefaultChoices":false,"DataExportTag":"Q39","QuestionType":"MC","Selector":"SAVR","SubSelector":"TX","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"When you are given the trend line, where should you place the \"best guess\" dot?","Choices":{"1":{"Display":"Where the trendline is at the vertical red line"},"2":{"Display":"Where the trendline is at the last sales data point"},"3":{"Display":"It's not possible to say"},"4":{"Display":"At 100"}},"ChoiceOrder":["1","2","3","4"],"Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":5,"NextAnswerId":1,"QuestionID":"QID206"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID204","SecondaryAttribute":"Which one of the two stores has more variation (and uncertainty) in sales?","TertiaryAttribute":null,"Payload":{"QuestionText":"Which one of the two stores has more variation (and uncertainty) in sales?\n<br><br>\n<img src=\"https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/comp1.jpeg\" id=\"exampleImage\">\n<img src=\"https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/comp2.jpeg\" id=\"exampleImage\">","DataExportTag":"Q37","QuestionType":"MC","Selector":"SAVR","SubSelector":"TX","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Which one of the two stores has more variation (and uncertainty) in sales?","Choices":{"1":{"Display":"Store A"},"2":{"Display":"Store B"},"3":{"Display":"They have the same amount of variation"},"4":{"Display":"I don't understand the question"}},"ChoiceOrder":["1","2","3","4"],"Randomization":{"Advanced":null,"TotalRandSubset":"","Type":"All"},"Validation":{"Settings":{"ForceResponse":"OFF","Type":"None"}},"Language":[],"NextChoiceId":7,"NextAnswerId":1,"QuestionID":"QID204","RecodeValues":{"1":"2","2":"1","3":"3","4":"4"}}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID197","SecondaryAttribute":"You will now make your 15 predictions. Make sure you try your best - if your slider ratings are c...","TertiaryAttribute":null,"Payload":{"QuestionText":"<span style=\"font-size: 19px;\">You will now make your 15 predictions.<\/span><br><span style=\"font-size:16px;\"><br>Make sure you try your best - if your slider ratings are close to the right answers (for both the best guess and uncertainty), you increase your chances to win one of our thirty $10 prizes.&nbsp;&nbsp;<\/span>","DefaultChoices":false,"DataExportTag":"Q30","QuestionType":"DB","Selector":"TB","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"You will now make your 15 predictions. Make sure you try your best - if your slider ratings are c...","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID197"}},{"SurveyID":"SV_8vr7RhqCus0Ekui","Element":"SQ","PrimaryAttribute":"QID193","SecondaryAttribute":"Your job is to look at the graph and determine the likelihood of different levels of sales on the...","TertiaryAttribute":null,"Payload":{"QuestionText":"Your job is to look at the graph and determine the likelihood of different levels of sales on the chosen day. To modify your answers, you use the sliders below the graph.&nbsp;Try your best to get the right answer and then click the button to see the right answer:<div class=\"container\">\n <div style=\"position: relative; display: inline-block;\" id=\"imageContainer\">\n  <img src=\"https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/practice1.jpeg\" id=\"exampleImage\">\n  <span class=\"hidden\" id=\"dot\">\u2022<\/span>\n <\/div>\n <table>\n  <tbody class=\"hidden\" id=\"probTable\">\n  <\/tbody>\n <\/table>\n<\/div>\n<input type=\"hidden\" id=\"correctMean\" value=\"78\">\n<input type=\"hidden\" id=\"correctVariance\" value=\"1.41\">\n\n<div id=\"slidersContainer\">\n    <div>\n        Best Guess: <span id=\"meanValue\">-<\/span><br>\n        <div class=\"slider-wrapper\">\n             <span id=\"instruction1\" class=\"slider-instruction\">Click here to choose<\/span>\n             <input value=\"100\" type=\"range\" step=\"1\" min=\"60\" max=\"140\" id=\"meanSlider\">\n             <div id=\"meanRedArea\" class=\"red-area\">\n                   <span class=\"exact-answer\">\u2022<\/span>\n             <\/div>\n       <\/div>   \n    <\/div>\n\n  \n    <div>\n        Uncertainty:<br>\n        <div class=\"slider-wrapper\">\n             <span id=\"instruction2\" class=\"slider-instruction\">Click here to choose<\/span>\n             <input value=\"1.1\" type=\"range\" step=\".01\" min=\"1\" max=\"5\" id=\"varianceSlider\">\n             <div id=\"varianceRedArea\" class=\"red-area\">\n                   <span class=\"exact-answer\">\u2022<\/span>\n             <\/div>\n       <\/div>         \n\n\n    <\/div>\n<\/div>\n\n<br>\n<button id=\"checkAnswer\">Click here to show the right answer on the sliders<\/button>\n<span id=\"predictionDesc\" class=\"hidden\">\n\n<br><br>The red dot shows you the right answer. <b> Since we provided the trendline, making a best guess is relatively easy since you just need to make the dot line up with where the trend hits the red vertical line.<\/b> In this problem the variability is also not very high so you should report low uncertainty.\n<br><br>\nYou should try your best to answer correctly. <b>We will pay 20% of people a bonus of $10.00 if they are close to the right answer for one random slider. The orange area shows how close you have to be to get the bonus.<\/b> If you are in that area and you and that slider get randomly chosen, you will get the bonus! \n<br><br>\nMove the sliders to the right answer to make sure you know the right answer for this example.\n<\/span>","QuestionJS":"Qualtrics.SurveyEngine.addOnload(function()\n{\n\n\t\n\n});\n\nQualtrics.SurveyEngine.addOnReady(function()\n{\n\t\n\n\tvar surveyEngineInstance = this; \/\/ Store the context for use later\n\t\n\tconsole.log(this.questionId);\n\t\n\t\n\t\n\t\/\/ Function to generate a random permutation of numbers using the Fisher-Yates algorithm\n\tfunction fisherYatesShuffle(array) {\n\t\tfor (let i = array.length - 1; i > 0; i--) {\n\t\t\tconst j = Math.floor(Math.random() * (i + 1));\n\t\t\t[array[i], array[j]] = [array[j], array[i]];\n\t\t}\n\t\treturn array;\n\t}\n\n\t\n\t\n\t\/\/this randomizes them into an order vector if they haven't been assigned yet\n\t\n\t\/\/ Check if randOrder embedded data field exists\n\tlet randOrder = Qualtrics.SurveyEngine.getEmbeddedData('randOrder');\n\tlet conditionNum = Qualtrics.SurveyEngine.getEmbeddedData('conditionNum');\t\n\tif (randOrder) {\n\t\t\/\/ If it exists, parse the string back to an array\n\t\trandOrder = JSON.parse(randOrder);\n\t\tconditionNum = JSON.parse(conditionNum);\n\t} else {\t\n\t\t\/\/ If it doesn't exist, generate the array and then store its stringified version in Qualtrics\n\t\t\t\n\t\t\/\/ Step 1: Generate randOrder array\n\t\tlet numbers = [];\n\t\tfor (let i = 1; i <= 40; i++) {\n    \t\tnumbers.push(i);\n\t\t}\n\t\tfisherYatesShuffle(numbers);\n\t\trandOrder = numbers.slice(0, 15); \/\/ First 15 entries\n\t    \n\t\t\n\t\t\/\/ Step 2: Generate conditionNum array\n\t\tlet conditionValues = [];\n\t\tfor (let i = 1; i <= 4; i++) {\n\t\t\tfor (let j = 0; j < 4; j++) {\n\t\t\t\tconditionValues.push(i);\n\t\t\t}\n\t\t}\n\t\tfisherYatesShuffle(conditionValues);\n\t\tconditionNum = conditionValues.slice(0, 15); \/\/ Randomly shuffled condition numbers\n\n\t\t\n\t\t\/\/ Step 3: Modify conditionNum and randOrder to get some repeats\n\n\t\t\/\/ Array of target values (1, 2, 3) to repeat\n\t\tlet targetValues = [1, 2, 3];\n\n\t\ttargetValues.forEach(value => {\n\t\t\tlet index = conditionNum.indexOf(value); \/\/ Find the first occurrence of the value\n\t\t\tconsole.log(\"index=\"+ index + \"for value\" + value);\n\t\t\tif (index !== -1) {\n\t\t\t\tlet newIndex = Math.min(index + 7, 14); \/\/ Ensure newIndex doesn't exceed 14\n\t\t\t\tconditionNum[newIndex] = value; \/\/ Set conditionNum at newIndex to the same value\n\t\t\t\trandOrder[newIndex] = randOrder[index]; \/\/ Set randOrder at newIndex to randOrder[index]\n\t\t\t}\n\t\t});\n\t\n\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('randOrder', JSON.stringify(randOrder));\n\t\tQualtrics.SurveyEngine.setEmbeddedData('conditionNum', JSON.stringify(conditionNum));\n\t\t\n\t}\n\tconsole.log(\"randOrder: \" + randOrder);\n\tconsole.log(\"conditionNum: \" + conditionNum);\n\t\n\t\n\t\/\/set listeners on sliders\n\tvar sliderMean = document.getElementById(\"meanSlider\");\n\tvar sliderVar = document.getElementById(\"varianceSlider\");\n\tsliderMean.oninput = function() {\n\t\tsurveyEngineInstance.enableNextButton();\n    \tthis.classList.add('show-thumb');  \/\/shows the slider button\n\t\tdocument.getElementById(\"instruction1\").style.display = 'none';  \/\/removes the \"click here\" text\n\t\tupdateMeanValue(this.value);\n  \t};\n\t\n\tsliderVar.oninput = function() {\n\t\tsurveyEngineInstance.enableNextButton();\n\t\tthis.classList.add('show-thumb'); \/\/shows the slider button\n\t\tdocument.getElementById(\"instruction2\").style.display = 'none'; \/\/removes the \"click here\" text\n    \tupdateVarianceValue(this.value);\n  \t};\n\t\n\t function erf(x) {\n        const a1 =  0.254829592;\n        const a2 = -0.284496736;\n        const a3 =  1.421413741;\n        const a4 = -1.453152027;\n        const a5 =  1.061405429;\n        const p  =  0.3275911;\n\n        const sign = (x < 0) ? -1 : 1;\n        x = Math.abs(x);\n\n        const t = 1.0 \/ (1.0 + p * x);\n        const y = (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t;\n\n        return sign * (1 - y * Math.exp(-x * x));\n    }\n\n\t\n     function cdf(x, mean, variance) {\n        return 0.5 * (1 + erf((x - mean) \/ Math.sqrt(2 * variance)));\n    }\n   \n\n\tfunction updateVarianceValue(value) {\n        \/\/document.getElementById('varianceValue').textContent = value;\n        computeProbabilities();\n        saveDataToQualtrics();\n    }\n\n\t\n    function updateMeanValue(value) {\n        document.getElementById('meanValue').textContent = value; \/\/display the mean for the person to see\n\t\tcomputeProbabilities();\n        adjustDotPosition();\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\/\/this just ensures everything is fine if the person changes their window size\n\t\n\t\/\/window.addEventListener('resize', function() {\n\t\/\/\tcomputeProbabilities();\n\t\/\/\tadjustDotPosition();\n\t\/\/});\n\n\n\tfunction adjustDotPosition() {\n\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\t\n\t\tconst slider = document.getElementById('meanSlider');\n\t\tconst dot = document.getElementById('dot');\n\t\tconst image = document.getElementById('exampleImage');\n\n\t\tconst sliderRange = 140-60;\n\t\tconst sliderPosition = (parseFloat(slider.value) - 60) \/ sliderRange;\n\t\t\n\t\tconst imageHeight = image.offsetHeight;\n\t\tconst imageWidth = image.offsetWidth-22;\n\t\tconst dotHeight = dot.offsetHeight;\n\n\t\t\/\/ Calculate the top position based on the image height and the slider's value.\n\t\tconst topPosition = 18+.78*(imageHeight * (1 - sliderPosition) - dotHeight \/ 2);\n\t\t\n\t\tdot.style.top = topPosition + \"px\";\n\t\tdot.style.left = imageWidth + \"px\"; \/\/ Ensure dot is on the right side of the image.\n\t}\n\n\n    function computeProbabilities() {\n        \n        const mean = parseFloat(document.getElementById('meanSlider').value);\n\t\t\/\/the formula below takes var -> the slider is in root(SD) so needs to be ^4\n        const variance = Math.pow(parseFloat(document.getElementById('varianceSlider').value),4);\n        const intervals = [[130,140],[120,130],[110,120],[100,110],[90,100],[80,90],[70,80],[60,70]];\n        const letters = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\"];\n\n\t\t\/\/this makes sure the heights line up with the picture \n\t\tconst imgHeight = document.getElementById('exampleImage').offsetHeight;\n        const spacerPercentage1 = 0.04;\n        const spacerHeight1 = imgHeight * spacerPercentage1;\n        const spacerPercentage2 = 0.22;\n        const spacerHeight2 = imgHeight * spacerPercentage2;\n        const letterRowHeight = (imgHeight - (spacerHeight1+spacerHeight2)) \/ 8;  \/\/ subtracting the two spacer rows and dividing by # rows\n\n        const tbody = document.getElementById('probTable');\t\t\n\t\ttbody.innerHTML = '';\n\t\ttbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n        intervals.forEach((interval, index) => {\n            const prob = (cdf(interval[1], mean, variance) - cdf(interval[0], mean, variance)) * 100;\n           \n            \/\/ Create a bar inside a container\n            const bar = '<div class=\"bar-container\"><div class=\"bar\" style=width:'+prob+'%;\"><\/div><\/div>';\n\n            const row ='<tr height='+letterRowHeight+'px><td>'+bar+'<\/td><td width=200>'+prob.toFixed(1)+'%<\/td><\/tr>';\n           \n            tbody.innerHTML += row;\n        });\n        tbody.innerHTML +='<tr height='+spacerHeight1+'px><td><\/td><\/tr>';\n    }\n\t\t\n\tfunction randomizeImage() {\n\t\tconst image = document.getElementById('exampleImage');\n\t\t\/\/ Now, you can use `randOrder` in the current page\n\t\tconst imageNumber = randOrder[window.loopCounter - 1];\n\t\tconst conditionNumber = conditionNum[window.loopCounter - 1];\n\t\timage.src = 'https:\/\/faculty.haas.berkeley.edu\/ned\/TAO\/images_4\/'+imageNumber+\"_\"+conditionNumber+'.jpeg';\n\t\tconsole.log(image.src);\n\t}\n\n\tfunction saveDataToQualtrics() {\n\t\tvar sliderMean = document.getElementById(\"meanSlider\").value;\n\t\t\/\/we are recording in SD -> the slider is in root(SD)\n\t\tvar sliderVar = Math.pow(parseFloat(document.getElementById('varianceSlider').value),2);\n\t\tconst condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\t\n\t\t\/\/so, this is hacky, but randomizing images but not the test images, so want to store test images as -2,-1...\n\t\tlet imageNumber=window.loopCounter;\n\t\tlet conditionNumber=window.loopCounter;\n\t\tif (window.loopCounter>0) {\n\t\t\timageNumber = randOrder[window.loopCounter - 1];\n\t\t\tconditionNumber = conditionNum[window.loopCounter - 1];\n\t\t}\n\t\tvar combinedData = window.currentData + window.loopCounter + \"~\" + condition+ \"~\" +imageNumber+\"_\"+ conditionNumber +'.jpeg~' + sliderMean + \"~\" + sliderVar + \"~\";\n\t\tQualtrics.SurveyEngine.setEmbeddedData('allSliderData', combinedData);\n\t\tconsole.log(\"allSliderData:\"+Qualtrics.SurveyEngine.getEmbeddedData('allSliderData'));\n    \n\t}\t\n\n\n\n\tfunction adjustRedArea(sliderId, areaId, correctValue, range) {\n\t\tconst slider = document.getElementById(sliderId);\n\t\tconst redArea = document.getElementById(areaId);\n\n\t\tconst totalWidth = slider.offsetWidth;\n\t\tconst minValue = parseFloat(slider.min);\n\t\tconst maxValue = parseFloat(slider.max);\n\n\t\tconst startValue = correctValue - range;\n\t\tconst endValue = correctValue + range;\n\t\t\n\t\tconst thumbWidth = 3; \/\/ Assuming 20px is your thumb width\n\n        const startPos = (startValue - minValue) \/ (maxValue - minValue) * 100 + thumbWidth;\n        const endPos = (endValue - minValue) \/ (maxValue - minValue) * 100 + thumbWidth;\n\n\t\tredArea.style.left = startPos+\"%\";\n\t\twidthPos=endPos-startPos;\n\t\tredArea.style.width = widthPos+\"%\";\n\t\tredArea.style.display = 'block'; \/\/ show the red area\n\t}\n\n\t\n\t\/\/for instructions, person wants to see the answers.\n\tif (document.getElementById('checkAnswer')) {\n\t\t\n\t\t\/\/so they don't get the next button until they press\n\t\t surveyEngineInstance.disableNextButton();\n\n\t   document.getElementById('checkAnswer').addEventListener('click', function() {\n\t\t    surveyEngineInstance.enableNextButton();\n\t\t   \n\t\t   \/\/ Example correct answer values. You can set these dynamically based on your data.\n\t\t  const correctMean = parseFloat(document.getElementById('correctMean').value);\n\t\t  const correctVariance = parseFloat(document.getElementById('correctVariance').value);\n\n\t\t  \/\/ Calculate positions for the red area -> the last variables have the size of the bonus area\n\t\t  adjustRedArea('meanSlider', 'meanRedArea', correctMean, 4);\n\t\t  adjustRedArea('varianceSlider', 'varianceRedArea', correctVariance, 0.25);\n\t\t\n\t\t  document.getElementById('predictionDesc').classList.remove('hidden');\n\t   });\n\t}\t\n\t\n\t\n\t\/\/for instructions: if there is a \"show prediction button\"\n\tif (document.getElementById(\"showPrediction\")) {\n\t\t surveyEngineInstance.disableNextButton();\n\t\tdocument.getElementById(\"showPrediction\").addEventListener(\"click\", function() {\n\t\t\t surveyEngineInstance.enableNextButton();\n\t\t\t\/\/ Show the table (with bars)\n\t\t\tdocument.getElementById('probTable').classList.remove('hidden');\n\t\t\tdocument.getElementById('dot').classList.remove('hidden');\n\t\t\tdocument.getElementById('predictionDesc').classList.remove('hidden');\n\n\t\t\tcomputeProbabilities();\n\t\t\tadjustDotPosition();\t\t\n\t\t});\n\t};\n\n\n\t\n\t\/\/if we are in question with a slider bar\n\n\tif (document.getElementById('meanValue')) {\t\t\n\t\t surveyEngineInstance.disableNextButton();\n\t\t\/\/want to keep track of the loop number\n\t\twindow.loopCounter = parseInt(Qualtrics.SurveyEngine.getEmbeddedData('loopCounter'));\n\t\tconsole.log(\"-> retreived loop number:\"+loopCounter);\n\t\t\n\t\t\/\/update the loop number\t\t\n\t\tQualtrics.SurveyEngine.setEmbeddedData('loopCounter', loopCounter+1);\n\t\tconst loopCounterNew=window.loopCounter+1;\n\t\tconsole.log(\"-> updated loop number to \" +loopCounterNew);\n\t\t\n\t\t\/\/want to keep this stable so we can add to it:\n\t\twindow.currentData = Qualtrics.SurveyEngine.getEmbeddedData('allSliderData') || \"\";\n\t\t\n\t\t\/\/randomizing the image prefix\n\t\t\/\/const condition=Qualtrics.SurveyEngine.getEmbeddedData('Condition');\n\t\t\/\/window.prefix = \n\t\t\/\/(condition === \"cl\" && window.loopCounter <= 6) ? \"cl\" :\n\t\t\/\/(condition === \"cl\") ? \"fn\" :\n\t\t\/\/(condition === \"cn\" && window.loopCounter <= 6) ? \"cn\" :\n\t\t\/\/(condition === \"cn\") ? \"fl\" :\n\t\t\/\/(condition === \"fl\" && window.loopCounter <= 6) ? \"fl\" :\n\t\t\/\/(condition === \"fl\") ? \"cn\" :\n\t\t\/\/(condition === \"fn\" && window.loopCounter <= 6) ? \"fn\" :\n\t\t\/\/(condition === \"fn\") ? \"cl\" : \n\t\t\"\"; \/\/ default value, in case no conditions are met\n\t\t\n\t\t\/\/if we are in the main area, need to change image\n\t\tif (this.questionId.includes(\"QID195\")) {\n\t\t\trandomizeImage();\n\t\t}\n\t\t\n\t\tsaveDataToQualtrics();\n    }\n\t\n\n\t\n\t\n});\n\nQualtrics.SurveyEngine.addOnUnload(function()\n{\n\t\/*Place your JavaScript here to run when the page is unloaded*\/\n\n});","DefaultChoices":false,"DataExportTag":"Instructions3","QuestionType":"DB","Selector":"TB","DataVisibility":{"Private":false,"Hidden":false},"Configuration":{"QuestionDescriptionOption":"UseText"},"QuestionDescription":"Your job is to look at the graph and determine the likelihood of different levels of sales on the...","ChoiceOrder":[],"Validation":{"Settings":{"Type":"None"}},"GradingData":[],"Language":[],"NextChoiceId":4,"NextAnswerId":1,"QuestionID":"QID193"}}]}