Personality Survey — Summary of Results
Number of Participants: " . $numParticipants . ""); // FOR DEBUG -- REMOVE LATER
$labels_str = "Ex,Ag,Co,ES,Op,LS,Gr,sx,cs,groupcode,sessiondate";
$labels = explode(",", $labels_str);
$numDataValues = count($labels);
$Ex = array();
$Ag = array();
$Co = array();
$ES = array();
$Op = array();
$LS = array();
$Gr = array();
$sx = array();
$cs = array();
$groupcode= array();
// build array of summary data for each participant
for ($i=0; $i<$numParticipants; $i++) {
$rowdata = explode(",",$labdata[$i]);
// get seven variables
array_push($Ex, $rowdata[0]);
array_push($Ag, $rowdata[1]);
array_push($Co, $rowdata[2]);
array_push($ES, $rowdata[3]);
array_push($Op, $rowdata[4]);
array_push($LS, $rowdata[5]);
array_push($Gr, $rowdata[6]);
// get demographics
array_push($sx, $rowdata[7]);
array_push($cs, $rowdata[8]);
array_push($groupcode, $rowdata[9]);
}
// calculate summary results
$Ex_mean = array_sum($Ex) / count($Ex);
$Ag_mean = array_sum($Ag) / count($Ag);
$Co_mean = array_sum($Co) / count($Co);
$ES_mean = array_sum($ES) / count($ES);
$Op_mean = array_sum($Op) / count($Op);
$LS_mean = array_sum($LS) / count($LS);
$Gr_mean = array_sum($Gr) / count($Gr);
$Ex_mean = number_format($Ex_mean, 2);
$Ag_mean = number_format($Ag_mean, 2);
$Co_mean = number_format($Co_mean, 2);
$ES_mean = number_format($ES_mean, 2);
$Op_mean = number_format($Op_mean, 2);
$LS_mean = number_format($LS_mean, 2);
$Gr_mean = number_format($Gr_mean, 2);
$Ex_stdev = standard_deviation($Ex);
$Ag_stdev = standard_deviation($Ag);
$Co_stdev = standard_deviation($Co);
$ES_stdev = standard_deviation($ES);
$Op_stdev = standard_deviation($Op);
$LS_stdev = standard_deviation($LS);
$Gr_stdev = standard_deviation($Gr);
$Ex_stdev = number_format($Ex_stdev, 2);
$Ag_stdev = number_format($Ag_stdev, 2);
$Co_stdev = number_format($Co_stdev, 2);
$ES_stdev = number_format($ES_stdev, 2);
$Op_stdev = number_format($Op_stdev, 2);
$LS_stdev = number_format($LS_stdev, 2);
$Gr_stdev = number_format($Gr_stdev, 2);
echo "
Here are the pooled results from the Big Five Personality items and the Happiness and Gratitude items for all $numParticipants participants. Copy these values to the second page of your data sheet.
";
echo "
| BIG FIVE PERSONALITY FACTORS | OTHER VARIABLES |
";
echo " | Extraversion | Agreeableness | Conscientiousness | Emotional Stability | ";
echo "Openness | Happiness | Gratitude |
";
echo "| MEAN | $Ex_mean | $Ag_mean | $Co_mean | $ES_mean | ";
echo "$Op_mean | $LS_mean | $Gr_mean |
";
echo "| STDEV | $Ex_stdev | $Ag_stdev | $Co_stdev | $ES_stdev | ";
echo "$Op_stdev | $LS_stdev | $Gr_stdev |
|---|
";
echo "
Note: The maximum possible score on each personality factor is 1000. Your profile of scores on the five factors is what distinguishes you from other people. Happiness scores and Gratitude scores can range up to 100. Happiness scores above 50 suggest that you are satisfied with your life, and Gratitude scores above 50 suggest that you have a grateful disposition.
";
function standard_deviation($aValues, $bSample = false)
{
$fMean = array_sum($aValues) / count($aValues);
$fVariance = 0.0;
foreach ($aValues as $i)
{
$fVariance += pow($i - $fMean, 2);
}
$fVariance /= ( $bSample ? count($aValues) - 1 : count($aValues) );
return (float) sqrt($fVariance);
}
?>
Statistical Analyses
Testing the Relationship between Personality and Happiness
Testing the Relationship between Gratitude and Happiness