core/js/IAT_gform.js
// Calculates estimate of effect size to present results to participant
Calculates estimate of effect size to present results to participant
Calculates estimate of effect size to present results to participant
function calculateIAT()
{
	compatible = 0;
	for (i=1; i<roundArray[3].length; i++)
	{
		score = roundArray[3][i].endtime - roundArray[3][i].starttime;
		if (score < 300) { score = 300; }
		if (score > 3000) { score = 3000; }
		compatible += Math.log(score);
	}
	compatible /= (roundArray[3].length - 1);
	incompatible = 0;
	for (i=1; i<roundArray[6].length; i++)
	{
		score = roundArray[6][i].endtime - roundArray[6][i].starttime;
		if (score < 300) { score = 300; }
		if (score > 3000) { score = 3000; }
		incompatible += Math.log(score);
	}
    incompatible /= (roundArray[6].length - 1);
    cvar = 0;
	for (i=1; i<roundArray[3].length; i++)
	{
		score = roundArray[3][i].endtime - roundArray[3][i].starttime;
		if (score < 300) { score = 300; }
		if (score > 3000) { score = 3000; }
	    cvar += Math.pow((Math.log(score) - compatible),2);
	}
	ivar = 0;
	for (i=1; i<roundArray[6].length; i++)
	{
		score = roundArray[6][i].endtime - roundArray[6][i].starttime;
		if (score < 300) { score = 300; }
		if (score > 3000) { score = 3000; }
	    ivar += Math.pow((Math.log(score) - incompatible),2);
	}
	tvalue = (incompatible - compatible) / Math.sqrt(((cvar/39) + (ivar/39))/40);
	if (Math.abs(tvalue) > 2.89) { severity = " <b>sokkal inkább</b> "; }
	else if (Math.abs(tvalue) > 2.64) { severity = " <b>inkább</b> "; }	
	else if (Math.abs(tvalue) > 1.99) { severity = " <b>valamivel jobban</b> "; }
	else if (Math.abs(tvalue) > 1.66) { severity = " <b>valamivel jobban</b> "; }
	else { severity = ""; }
	if (tvalue < 0 && severity != "")
    { 
        resulttext = "<div style='text-align:center;padding:20px'>Az "+openA+template.catB.label+closeA+"eket "+severity+" a "+open1+template.cat1.label+close1;
        resulttext += " jelzőkkel kötöd össze, a "+openA+template.catA.label+closeA+"eket pedig a "+open1+template.cat2.label+close1;
        resulttext += " jelzőkkel, mint a "+openA+template.catA.label+closeA+"eket a "+open1+template.cat1.label+close1;
        resulttext += " jelzőkkel és az "+openA+template.catB.label+closeA+"eket a "+open1+template.cat2.label+close1+" jelzőkkel.</div>"; 
    }
    else if (tvalue > 0 && severity != "")
    { 
        resulttext = "<div style='text-align:center;padding:20px'>A "+openA+template.catA.label+closeA+"eket "+severity+" a "+open1+template.cat1.label+close1;
        resulttext += " jelzőkkel kötöd össze, a "+openA+template.catB.label+closeA+"eket pedig a "+open1+template.cat2.label+close1;
        resulttext += " jelzőkkel, mint az "+openA+template.catB.label+closeA+"eket a "+open1+template.cat1.label+close1;
        resulttext += " jelzőkkel és a "+openA+template.catA.label+closeA+"eket a "+open1+template.cat2.label+close1+" jelzőkkel.</div>"; 
    }
    else
    { 
        resulttext = "<div style='text-align:center;padding:20px'>Nem asszociálsz a "+openA+template.catA.label+closeA;
        resulttext += "ek esetében inkább, vagy kevésbé a "+open1+template.cat1.label+close1+"ra, mint az ";
        resulttext += openA+template.catB.label+closeA+"ek esetében a "+open1+template.cat1.label+close1+"ra.</div>"; 
    }
	$("#picture_frame").html(resulttext);
}
function calculateIAT ( ) { compatible = 0 ; for ( i = 1 ; i < roundArray [ 3 ] . length ; i ++ ) { score = roundArray [ 3 ] [ i ] . endtime - roundArray [ 3 ] [ i ] . starttime ; if ( score < 300 ) { score = 300 ; } if ( score > 3000 ) { score = 3000 ; } compatible += Math . log ( score ) ; } compatible /= ( roundArray [ 3 ] . length - 1 ) ; incompatible = 0 ; for ( i = 1 ; i < roundArray [ 6 ] . length ; i ++ ) { score = roundArray [ 6 ] [ i ] . endtime - roundArray [ 6 ] [ i ] . starttime ; if ( score < 300 ) { score = 300 ; } if ( score > 3000 ) { score = 3000 ; } incompatible += Math . log ( score ) ; } incompatible /= ( roundArray [ 6 ] . length - 1 ) ; cvar = 0 ; for ( i = 1 ; i < roundArray [ 3 ] . length ; i ++ ) { score = roundArray [ 3 ] [ i ] . endtime - roundArray [ 3 ] [ i ] . starttime ; if ( score < 300 ) { score = 300 ; } if ( score > 3000 ) { score = 3000 ; } cvar += Math . pow ( ( Math . log ( score ) - compatible ) , 2 ) ; } ivar = 0 ; for ( i = 1 ; i < roundArray [ 6 ] . length ; i ++ ) { score = roundArray [ 6 ] [ i ] . endtime - roundArray [ 6 ] [ i ] . starttime ; if ( score < 300 ) { score = 300 ; } if ( score > 3000 ) { score = 3000 ; } ivar += Math . pow ( ( Math . log ( score ) - incompatible ) , 2 ) ; } tvalue = ( incompatible - compatible ) / Math . sqrt ( ( ( cvar / 39 ) + ( ivar / 39 ) ) / 40 ) ; if ( Math . abs ( tvalue ) > 2.89 ) { severity = " <b>sokkal inkább</b> "; else if ( Math . abs ( tvalue ) > 2.64 ) { severity = " <b>inkább</b> "; else if ( Math . abs ( tvalue ) > 1.99 ) { severity = " <b>valamivel jobban</b> " ; } else if ( Math . abs ( tvalue ) > 1.66 ) { severity = " <b>valamivel jobban</b> " ; } else { severity = "" ; } if ( tvalue < 0 && severity != "" ) { resulttext = "<div style='text-align:center;padding:20px'>Az " + openA + template . catB . label + closeA + "eket " + severity + " a " + open1 + template . cat1 . label + close1 ; resulttext += " jelzőkkel kötöd össze, a "+ope n A+tem p late.cat A .lab e l+clo s eA+"ek e t pedig a "+ope n 1+tem p late.cat 2 .lab e l+clo s e1; resulttext += " jelzőkkel, mint a "+ o penA+ t emplate. c atA. l abel+ c loseA+ " eket a "+ o pen1+ t emplate. c at1. l abel+ c lose1; resulttext += " jelzőkkel és az "+o p enA+t e mplate.c a tB.l a bel+c l oseA+" e ket a "+o p en1+t e mplate.c a t2.l a bel+c l ose1+" jelzőkkel.</div>";  } else if ( tvalue > 0 && severity != "" ) { resulttext = "<div style='text-align:center;padding:20px'>A " + openA + template . catA . label + closeA + "eket " + severity + " a " + open1 + template . cat1 . label + close1 ; resulttext += " jelzőkkel kötöd össze, a "+ope n A+tem p late.cat B .lab e l+clo s eA+"ek e t pedig a "+ope n 1+tem p late.cat 2 .lab e l+clo s e1; resulttext += " jelzőkkel, mint az "+ o penA+ t emplate. c atB. l abel+ c loseA+ " eket a "+ o pen1+ t emplate. c at1. l abel+ c lose1; resulttext += " jelzőkkel és a "+o p enA+t e mplate.c a tA.l a bel+c l oseA+" e ket a "+o p en1+t e mplate.c a t2.l a bel+c l ose1+" jelzőkkel.</div>";  } else { resulttext = "<div style='text-align:center;padding:20px'>Nem asszociálsz a "+ o penA+ t emplate. c atA. l abel+ c loseA; resulttext += "ek esetében inkább, vagy kevésbé a "+ope n 1+tem p late.cat 1 .lab e l+clo s e1+"ra ,  mint az "; resulttext += openA + template . catB . label + closeA + "ek esetében a "+ o pen1+ t emplate. c at1. l abel+ c lose1+ " ra.</div>"; } $ ( "#picture_frame" ) . html ( resulttext ) ; }
Calculates estimate of effect size to present results to participant
Calculates estimate of effect size to present results to participant
// calculate mean log(RT) for first key trial // calculate mean log(RT) for second key trial // calculate variance log(RT) for first key trial // calculate variance log(RT) for second key trial // calculate t-value // determine effect size from t-value and create corresponding text // put together feedback based on direction & magnitude // resulttext += "<div>incompatible: "+incompatible+" ("+(ivar/39)+"); compatible: "+compatible+" ("+(cvar/39)+"); tvalue: "+tvalue+"</div>"; // resulttext += "<div>incompatible: "+incompatible+" ("+(ivar/39)+"); compatible: "+compatible+" ("+(cvar/39)+"); tvalue: "+tvalue+"</div>"; // resulttext += "<div>incompatible: "+incompatible+" ("+(ivar/39)+"); compatible: "+compatible+" ("+(cvar/39)+"); tvalue: "+tvalue+"</div>";